Skip to main content
All CollectionsReferrals & TrackingReferral Tracking Setup
Install the Roster Referral Tracking Script
Install the Roster Referral Tracking Script
Marcella Edwards avatar
Written by Marcella Edwards
Updated over 3 months ago

Introduction

This guide will walk you through the process of installing Roster's Referral Tracking Script to accurately track referral link clicks and referred orders on your store or website. Follow these steps to ensure seamless integration and effective attribution for your brand ambassadors.

Section 1: Supported Platforms

Shopify

The Roster link tracking and referral tracking scripts are automatically installed when you connect your store in Roster. You do not need to follow the steps on this page.

WooCommerce / BigCommerce / Wix / Ecwid

If you are on one of these e-commerce platforms, reference the platform-specific guides for WooCommerce, BigCommerce, Wix or Ecwid. Otherwise, continue with the steps below for a custom pixel integration.

Section 2: Installation Overview

The Referral Tracking Script is the mechanism by which Roster is able to track referral link clicks and referred orders on your store or website. To enable accurate tracking, follow these four steps:

Step 1: Get Your Public Access Token

  • Navigate to the Integrations settings in the Brand Portal.

  • In the API Access Tokens section, generate a new Public Access Token.

  • Keep the newly created Public Access Token handy for Step 2 and Step 3.

    • NOTE: The tracking scripts will NOT work with a Private Access Token.


Step 2. Add the click-tracking script to your store/site

The click tracking script attributes incoming link clicks to the correct ambassador using a Roster referral link. Follow these steps:

  1. Copy the following JavaScript code to your clipboard:

    <!-- Roster -->
    <script async type="application/javascript" src="https://sa.getroster.com/sa.js?token=ACCESS_TOKEN"></script>
  2. Paste the JavaScript just before the closing </head> tag in your site or store template. Ensure this script is added to every page of your site.

  3. Replace ACCESS_TOKEN with the Public Access Token from Step 1.

  • Note: if you've installed our script in a tag manager (e.g. Google or Adobe) there is a higher chance our script will be blocked by an ad blocker. It's recommended that you install this script directly to the website.


Step 3: Add the Order Tracking Script to Your Store/Site

The order tracking script attributes referred orders (conversions) to the correct ambassador. Follow these steps:

  1. Copy the JavaScript below to your clipboard.

    1. Provide as much order data as possible to ensure accurate sales attribution processing in Roster. Note the required attributes indicated below. If the orderDate isn't provided, the system will auto set it to the current timestamp. It's recommended you set it to the date the order was created.

    <!-- START: Roster Order Submission-->
    <script type="application/javascript">
    function submitOrder() {
    if (sAttribution) {
    sAttribution.set({
    orderId: "123456", // required
    orderNumber: "56789ABC", // recommended
    orderDate: "2024-01-12", // Format: YYYY-MM-DDT00:00:00
    discountCodes: ["sale2020", "janedoe123"], // recommended
    currency: "USD", // required
    subtotalPrice: 17.00, // recommended
    totalPrice: 29.99, // required
    customerId: "9876ABC", // recommended
    firstName: "John",
    lastName: "Doe",
    email: "[email protected]", // required
    });
    sAttribution.emitOrder();
    }
    }

    var saScript = document.createElement("script");
    saScript.addEventListener("load", submitOrder);
    saScript.src = "https://sa.getroster.com/sa.js?token=ACCESS_TOKEN";
    document.body.appendChild(saScript);
    </script>
    <!-- END: Roster Order Submission -->

  2. Paste the JavaScript just before the closing </body> tag on the order confirmation page or the page that loads upon a successful conversion.

  3. Replace ACCESS_TOKEN with the Public Access Token from Step 1.

    • Replace the mocked parameter values in the JavaScript with actual code that sets these values at runtime. Refer to our API Documentation for more details.

    • Ensure that one of the conditions for Roster to attribute an order to an ambassador is met, as outlined in the note.


Step 4: Verify the Installation Process

  1. You're almost done with the integration! Now, it's time to test and verify that everything is set up correctly. Refer to our article on how to test your tracking script installation for detailed steps.

  2. If you encounter any issues during the verification process, please see our Troubleshooting Tips for assistance.


Related Articles


Conclusion

By following these steps, you'll ensure that Roster accurately tracks referral link clicks and referred orders, allowing your brand ambassadors to thrive and your referral program to flourish. If you need further assistance, don't hesitate to contact our support team!

Did this answer your question?