How to
Implement Script Tracking for Leads
This page explains the process of implementing the script tracking for Retrack.
Sign in to the platform
Click here to access your account.
Find your tracking code
Navigate to Programs and select one of your programs. There should be at least one available. Make sure to click on the "view" icon in order to get into the correct page. On the top you will find the Script Generator widget, which looks like this:
Choose the event you'd like to implement and you will be presented with a script. Here is one example:
<script type="text/javascript">
!function(){"re" in window||(window.re=function(){window.re.q.push(arguments)},window.re.q=[]);var e=document.createElement("script");e.src="https://retrack-app.com/track/v2/script",e.async=!0;var n=document.scripts[0];n.parentElement.insertBefore(e,n.nextSibling)}();
// Object. Required
re('addLead', {
// UUID. Base event for the lead.
event: '5009fafe-1eb0-11eb-adc1-0242ac120002',
// UUID. Replace with actual click UUID from cookie: Example: ce5fc4b5-0ddc-4176-ba64-44c3423bbae1
click: '625fae10-1eb0-11eb-adc1-0242ac120002',
// String. Replace with actual lead reference number. Must be unique for this lead. User ID for example.
reference: '{reference}',
// String. Optional (remove or leave empty if not applicable). Replace with actual voucher / coupon code. Comma separated if there are multiple codes.
voucher: '{voucher}'
});
re('send');
</script>
Make sure you replace all values between curly brackets {} to the actual values from the lead.
Create a redirect page
You will receive traffic from Retrack with the following two URL parameters: click and deeplink. Here is one example:
https://www.store-domain.com/retrack?click=625fae10-1eb0-11eb-adc1-0242ac120002&deeplink=https%3A%2F%2Fwww.store-domain.com%2Fsome-product
Create a new page that can accept these two parameters. The click identifier should be saved for later use and must persist for 10 days. You can choose to save it in a coookie, in the session, or any other way that makes it persistant. Once the click identifier is stored the user should be redirected to the deeplink URL.
The redirect URL can be any URL on your main store domain. Just make sure to communicate the exact URL of this page to Retrack.
Display the tracking code
Whenever a lead is generated, you should check the existence of the cookie you created in the previous step. If it does not exist, continue as normal. If it does exist, display the tracking script on the confirmation page. The code can be put anywhere between <head></head>, or before the ending </body> tag.
Done
That's it! You have now implemented tracking for Retrack. We would now like to test the implementation before it goes live. Reach out to us with testing instructions.