Skip to main content
All CollectionsReferrals & TrackingReferral Tracking Setup
Shopify Referral Tracking Script Manual Installation Instructions
Shopify Referral Tracking Script Manual Installation Instructions

Learn how Roster streamlines the process for Shopify referral tracking setup, ensuring efficient integration for your online store.

Libby Serra avatar
Written by Libby Serra
Updated over a week ago

When you connect our Shopify app, the Roster tracking script is automatically installed on your Shopify store. In most cases, manual installation of the tracking script is unnecessary unless you encounter one of the following situations:

  1. Multiple Stores Linked to a Single Roster Account.

  2. You are using a headless Shopify storefront or another custom storefront.

  3. Company Policies Preventing Connection to Our Shopify App.

If you find yourself in one of these scenarios, we recommend collaborating with our support team to obtain the necessary security information for Roster installation on your store. Stores that do not install our Shopify app may miss out on several integrated features.

Manual Shopify Referral Tracking Installation Instructions

*Note: When following these steps be sure to begin by referencing the instructions outlined in the main article.

Step 1: Adding the Click Tracking Script

  1. Access your Shopify store admin portal and navigate to Online Store > Themes > Edit code.

  2. Open the "theme.liquid" file to edit the code.

  3. Follow the instructions in Step 2 of the main article to embed the tracking script just before the closing </head> tag in your HTML:

    <!-- Roster -->
    <script async type="application/javascript" src="https://sa.getroster.com/sa.js?token=ACCESS_TOKEN"></script>

IMPORTANT: Replace "ACCESS_TOKEN" with your public access token, as created in Step 1 of the main article.


Step 2: Integrating Order Tracking

  1. Go to Settings > Checkout in your Shopify store.

  2. Scroll down to the Order processing section and paste the following code into the Additional scripts box. Make sure to replace the "ACCESS_TOKEN" placeholder with your public access token from Step 1 of the main article:

<!-- Roster Order Submission: START -->
<script type="application/javascript">
function submitOrder() {
if (sAttribution) {
sAttribution.set({
orderId: "{{ order.id }}",
discountCodes: [{% for discount in order.discount_applications %} "{{ discount.title }}", {% endfor %}],
currency: "{{ shop.currency }}",
subtotalPrice: {{ order.subtotal_price | money_without_currency }},
totalPrice: {{ order.total_price | money_without_currency }},
firstName: "{{ order.customer.first_name }}",
lastName: "{{ order.customer.last_name }}",
email: "{{ order.email }}"
});
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>
<!-- Roster Order Submission: END -->

Again, replace "ACCESS_TOKEN" with your public access token as instructed in Step 1.


Testing and Conclusion

Follow the guidance in Step 4 of the main article to ensure that your setup is correct.

Congratulation! Your Shopify store is now equipped to track referral link clicks and discount codes within Roster.


Troubleshooting Tips

If you encounter any issues or tests fail, visit our trouble shooting guide for assistance.
We're here to help!

Did this answer your question?