REFERRALS
Pixel tracking installation
Shopify Headless tracking pixel instructions
11 min
if brand is a shopify merchant using a headless storefront, you will need to include roster's link tracking pixel on your storefront web pages to capture link clicks from ambassadors' referral links and, if applicable, apply leakproof codes or shareable codes to customers' sessions you will not need to install roster's order tracking pixel, as that is handled by shopify's web pixel on the order confirmation page google tag manager we strongly discourage installing roster's tracking pixels through google tag manager (gtm) more and more browsers and extensions block gtm from loading, thereby blocking roster's tracking pixels from working we recommend installing roster's tracking pixels directly in your e commerce platform or website's global theme/template step 1 get a public access api token each of the two tracking pixels require a public access token in order to securely send tracking data from a customer's browser to your roster account you can use the same public access token for both tracking pixels log into your roster account go to the api integration page by clicking on your brand's name in the left hand navigation, then integrations > api integration copy the newest public access token if one exists, or click new access token to create a new one never use private access tokens with roster's tracking pixels public access tokens are safe to use in a browser environment, but private access tokens are only intended for server side usage as they allow full access to all roster api endpoints step 2 install the link tracking pixel roster's link tracking pixel tracks link clicks from ambassadors' referral links and saves ambassadors' referral link ids in the browser to track subsequent purchases add the following javascript tags just before the closing \</head> tag in your e commerce platform or website's global template \<script type="text/javascript"> window\ roster = { config { token 'your public access token', forceshareablecodefetch true }, onclicktracked function() { // optional callback see table below for details console log('click tracked'); }, oncoderetrieved function(discountcode) { // optional callback see table below for details console log('discount code ', discountcode); }, onerror function(error) { // optional callback see table below for details console error('roster pixel error ', error); } }; \</script> \<script async type="application/javascript" src="https //cdn rostercdn com/sa js">\</script> replace your public access token in the window\ roster config object with the public access token from step 1 above verify the link trakcing pixel after your have published the changes to your storefront or website, verify that link tracking is working by using an ambassador's referral link from your roster account see docid j9kdlpjtcpdkr6eblfwz to speed up the verification process using roster's chrome browser extension be sure you install the link tracking pixel in a way that will allow it to run on each page load this will ensure that regardless of which url ambassadors share as their referral link, roster will capture incoming link clicks and store the referral link ids for purchases made by referred customers see docid j9kdlpjtcpdkr6eblfwz to speed up the verification process using roster's chrome browser extension step 3 verify the installation process it's imperative that you test the link tracking and order tracking upon completing the above steps see docid\ hszdrydoq2cmtkv8cxbwp for a video walkthrough and detailed steps and docid j9kdlpjtcpdkr6eblfwz event reference for link tracking pixel callback signature description oncoderetrieved function(discountcode) called when a discount code is successfully returned from roster's shareable endpoint discountcode is a string containing the code to apply onclicktracked function(click) called when a referral click is tracked by the pixel click is an object containing click details such as referrallinkid , landingpageurl , referrerurl , queryparams , utmparams , useragent , linksource , linkvariant , characterset , title , location , externalid , and clicktimestamp onerror function(error) called when an error occurs during the shareable endpoint request or a callback error is caught error is a string or error object describing what went wrong config reference for link tracking pixel property type default description token string "" your public access api token required forceshareablecodefetch boolean false set to true to enable discount code retrieval on non shopify storefronts required for this integration need help? if you have any questions about adding hidden products to product rewards, contact us at mailto\ support\@getroster com