*Note: When following these steps be sure to begin by referencing the instructions outlined in this article.
Step 1. Add the Click Tracking Script
Ensure you have admin access permissions within your Ecwid account
In your admin portal, navigate to: Sales Channel > Overview > Header meta tags
Follow the instructions on Step 2 in the main article to embed the tracking script. You will copy/paste the code snippet to your store front so it tracks links on every page. Be sure to replace the ACCESS_TOKEN with your token.
โ
Step 2. Integrate Order Tracking
In your admin portal, navigate to: Settings > General > Analytics and Tracking > Custom tracking code on Order Confirmation page
Follow the instructions on Step 3 in the main article to embed the order tracking script and replace the placeholders with code variables from the order object.
Here's an example of the Roster tracking script with Ecwid order object variables set in the proper places.
<!-- Roster Order Submission: START -->
<script type="application/javascript">
<#noescape>
function submitOrder() {
if (sAttribution) {
var orderTotal = "${order.total}";
var cleanOrderTotal = orderTotal.replace(/\$/g,'');
var subTotal = "${order.subtotalWithoutTax}";
var cleanSubTotal = subTotal.replace(/\$/g,'');
sAttribution.set({
orderId: "${order.number}",
orderNumber: "${order.number}",
orderDate: "${order.dateCreated}", // Format: YYYY-MM-DDT00:00:00
discountCodes: ["${order.couponCode?js_string}"],
currency: "USD",
subtotalPrice: cleanSubTotal,
totalPrice: cleanOrderTotal,
firstName: "${customer.name?js_string}",
email: "${customer.email?js_string}"
});
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);
</#noescape>
</script>
<!-- Roster Order Submission: END -->
*Set your access token: be sure to replace the ACCESS_TOKEN placeholder with the public access token created in Step 1 in the main article.
Testing
Reference Step 4 in the main article to make sure you have everything setup.
Congrats, You're Done!!
You're all set up and your Ecwid store is now able to track referral links and discount codes within Roster.
Troubleshooting Tips
Some tests are failing? Go here for help with troubleshooting