Install the Roster Referral Tracking Script
L
Written by Libby Serra
Updated over a week ago

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 Brands

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 Brands

Follow the platform-specific guides for WooCommerce, BigCommerce, or Wix instead of the steps on this page.

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 your store has multiple sub-domains, ensure the tracking script works across all domains. See enable cookie tracking or contract our support team for assistance.


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. Note that orderId is the only required field, but providing accurate data for all available fields is recommended for better data quality.

    <!-- START: Roster Order Submission-->
    <script type="application/javascript">
    function submitOrder() {
    if (sAttribution) {
    sAttribution.set({
    orderId: "123456",
    orderNumber: "56789ABC",
    orderDate: "8/5/2020",
    discountCodes: ["sale2020", "janedoe123"],
    currency: "USD",
    subtotalPrice: 17.00,
    totalPrice: 29.99,
    customerId: "9876ABC",
    firstName: "John",
    lastName: "Doe",
    email: "[email protected]",
    isNewCustomer: true
    });
    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?