Full Example
Implement Script Tracking for Transactions
This page exemplifies the process of implementing the script tracking for Retrack, from Refunder to completed purchase.
1. Refunder publishes Awesome Store and redirects users to their store via a unique tracking link that looks like this:
https://www.retrack.com/track/v2/click?publisher=e5adcbc6-31a8-4e1b-8351-835dddc16921&program=fbe9b080-eb91-455a-b5cb-a17da12ddd4e
2. Retrack receives the user and tries to match the publisher and program identifiers from the URL to a specific advertiser. All click data and browser information is saved in the Retrack platform and the user is then redirected to Awesome Store using the follwing URL:
https://www.awesome-store.com/retrack?click=4ab932a4-cc8d-4074-bb71-5e80de25aea5deeplink=https%3A%2F%2Fwww.awesome-store.com%2Fsome-product
3. Awesome Store catches the two parameters click and deeplink.
click | 4ab932a4-cc8d-4074-bb71-5e80de25aea5 |
deeplink | https://www.awesome-store.com/some-product |
The click identifier is stored in a cookie with a TTL of 10 days. The deeplink is used to redirect the user to the correct landing page.
4. The user browses the store decides to purchase two products.
Product 1:
SKU | 4113 |
Title | Nike Air |
Quantity | 1 |
Price | 1250 |
Price without VAT | 1000 |
VAT | 250 |
VAT Rate | 25% |
Event UUID | 3ba44c11-cad4-4ae1-bb68-973cd0bce6bf |
Product 2:
SKU | 6720 |
Title | Summer Dress |
Quantity | 1 |
Price | 375 |
Price without VAT | 300 |
VAT | 75 |
VAT Rate | 25% |
Event UUID | cc467697-a82d-4435-a24d-5440ff3930a7 |
Order summary:
Order Number | 692549563 |
Order Sum | 1625 |
Order Sum without VAT | 1300 |
VAT Sum | 325 |
VAT Rate | 25% |
The Event UUID for each category is available in the Retrack platform.
5. Once checkout is completed the tracking script should be loaded on the order confirmation page.
<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('addTransaction', {
// UUID. Base event for the transaction. Can be overridden on product level using addProduct
event: '3ba44c11-cad4-4ae1-bb68-973cd0bce6bf',
// UUID. Replace with actual click UUID from cookie: Example: ce5fc4b5-0ddc-4176-ba64-44c3423bbae1
click: '4ab932a4-cc8d-4074-bb71-5e80de25aea5',
// String. Replace with actual order number. Example: test123
orderNumber: '692549563',
// Numeric. Replace with actual order sum in minor units (ie cents), excluding VAT. Example: 8000 (80 SEK)
orderSum: 130000,
// Numeric. Replace with actual VAT sum in minor units (ie cents). Example: 2000 (20 SEK)
vatSum: 32500,
// String. Replace with actual currency. Example: SEK
currency: 'SEK',
// String. Optional (remove or leave empty if not applicable). Replace with actual voucher / coupon code. Comma separated if there are multiple codes.
voucher: '',
// String. Optional (remove or leave empty if not applicable). Applicable if the order has a general discount. Use minor units (ie cents)
discountSum: 0
});
// Object. Optional, but preferred. Required with multiple events in the same transaction
re('addProduct', {
// UUID. Optional. This will override the base event for the transaction. Useful for orders with products belonging to multiple events
event: '3ba44c11-cad4-4ae1-bb68-973cd0bce6bf',
// String.Product reference. Could be SKU, ISBN or any other ID. Example: test123
reference: '4113',
// String. Product name. Example: Adidas Superstar
name: 'Nike Air',
// Numeric. Num products. Example: 1
quantity: 1,
// Numeric. Price per product in minor units (ie cents), excluding VAT. Example: 8000 (80 SEK)
price: 100000,
// Numeric. VAT amount per product in minor units (ie cents). Example: 2000 (20 SEK)
vat: 25000
});
// Object. Optional, but preferred. Required with multiple events in the same transaction
re('addProduct', {
// UUID. Optional. This will override the base event for the transaction. Useful for orders with products belonging to multiple events
event: 'cc467697-a82d-4435-a24d-5440ff3930a7',
// String.Product reference. Could be SKU, ISBN or any other ID. Example: test123
reference: '6720',
// String. Product name. Example: Adidas Superstar
name: 'Summer Dress',
// Numeric. Num products. Example: 1
quantity: 1,
// Numeric. Price per product in minor units (ie cents), excluding VAT. Example: 8000 (80 SEK)
price: 30000,
// Numeric. VAT amount per product in minor units (ie cents). Example: 2000 (20 SEK)
vat: 7500
});
re('send');
</script>
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.