Line Item Tracking

Step 1. Adding the Order Tracking Code

  • This step tracks the transaction_id appended to the link when redirecting to the merchant website.
  • The merchant is free to add specific triggers such as “utm_source=shopback”.
  • Please add the following code snippet into ALL page(s) that users first land on in order to support tracking on all landing pages.
  • Take note not to add this snippet to the checkout page
<script>
!function(){var o=window.tdl=window.tdl||[];if(o.invoked)window.console&&console.error&&console.error("Tune snippet has been included more than once.");else{o.invoked=!0,o.methods=["init","identify","convert"],o.factory=function(n){return function(){var e=Array.prototype.slice.call(arguments);return e.unshift(n),o.push(e),o}};for(var e=0;e<o.methods.length;e++){var n=o.methods[e];o[n]=o.factory(n)}o.init=function(e){var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://js.go2sdk.com/v2/tune.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(n,t),o.domain=e}}}();
 
tdl.init("https://shopback.go2cloud.org");
tdl.identify();
</script>

Step 2. Adding the Conversion Code - Line Item Tracking

  • This snippet is used to convert user purchases and send the purchase information to ShopBack.
  • The snippet below is for Line Item Tracking only.
  • ShopBack uses line-item tracking whereby each line item is captured in one line with the quantity amount and amount as line item subtotal amount.
  • For Order Tracking, please follow this section instead.
  • Please add the following code snippet below to the checkout page only
<script>
!function(){var o=window.tdl=window.tdl||[];if(o.invoked)window.console&&console.error&&console.error("Tune snippet has been included more than once.");else{o.invoked=!0,o.methods=["init","identify","convert"],o.factory=function(n){return function(){var e=Array.prototype.slice.call(arguments);return e.unshift(n),o.push(e),o}};for(var e=0;e<o.methods.length;e++){var n=o.methods[e];o[n]=o.factory(n)}o.init=function(e){var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://js.go2sdk.com/v2/tune.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(n,t),o.domain=e}}}();

tdl.init("https://shopback.go2cloud.org");
let items = itemsPath;
for (var i = 0; i < items.length; i++) { 
   tdl.convert({
     'adv_sub': '{{ customer_facing_order_id }}',
     'adv_sub2': '{{ optional_sub2 }}',
     'adv_sub3': '{{ optional_sub3 }}',
     'adv_sub4': '{{ optional_sub4 }}',
     'adv_sub5': '{{ optional_sub5 }}',
     'adv_unique1': '{{ optional_sub6 }}',
     'adv_unique2': '{{ optional_sub7 }}',
     'adv_unique3': '{{ optional_sub8 }}',
     'adv_unique4': '{{ optional_sub9 }}',
     'adv_unique5': '{{ optional_sub10 }}',
     'amount': '{{ final_line_subtotal }}',
  })
}
</script>

📘

In order to convert multiple items, the tdl.convert method is utilized repeatedly.

You may use any form loop code to achieve the same result. In the example above, a for loop is used.

Example Conversion Code

<script>
!function(){var o=window.tdl=window.tdl||[];if(o.invoked)window.console&&console.error&&console.error("Tune snippet has been included more than once.");else{o.invoked=!0,o.methods=["init","identify","convert"],o.factory=function(n){return function(){var e=Array.prototype.slice.call(arguments);return e.unshift(n),o.push(e),o}};for(var e=0;e<o.methods.length;e++){var n=o.methods[e];o[n]=o.factory(n)}o.init=function(e){var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src="https://js.go2sdk.com/v2/tune.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(n,t),o.domain=e}}}();

tdl.init("https://shopback.go2cloud.org");
let items = itemsPath;
for (var i = 0; i < items.length; i++) { 
   tdl.convert({
     'adv_sub': 'MY1001',
     'adv_sub2': 'Electronics',
     'adv_sub3': 'A2648',
     'adv_sub4': 'iPhone 14',
     'adv_sub5': '15000.00',
     'adv_unique1': '2',
     'amount': '8000.00',
  })
}
</script>

Conversion Parameters Reference - Line Item Tracking

ShopBack currently supports tracking 10 different conversion parameters with 1 of them reserved for customer-facing order id.

Using Line Item Tracking requires more mandatory item-level parameters to be captured by ShopBack.

Please see the below explanation:

Parameter NameParameter ValueExample ValueDescriptionFormatRequired?
adv_sub{ customer_facing_order_id }MY1001Customer-facing order idalphanumericmandatory
adv_sub2{ line_item_category }ElectronicsProduct categoryalphanumeric
adv_sub3{ line_item_id }A2648Product ID or SKU IDalphanumericmandatory
adv_sub4{ line_item_name }iPhone 14Product namealphanumeric
adv_sub5{ order_total }1234.56Total order amount. The commission amount will be calculated based on this amount.- numeric value (2 decimals max)
- will not accept “,” (commas)
- will not accept “MYR” (currency code)
mandatory
adv_unique1{ line_item_quantity }5Product quantityalphanumericmandatory
adv_unique2alphanumericoptional
adv_unique3alphanumericoptional
adv_unique4alphanumericoptional
adv_unique5alphanumericoptional
amount{ final_line_subtotal }1234.56The combined price of all of the items in the line item. This includes any line-level discounts such as coupon codes or credits.

The value is equal to line_item_final_price multiplied by line_item_quantity.
- numeric value (2 decimals max)
- will not accept “,” (commas)
- will not accept “MYR” (currency code)
mandatory

👍

Please notify your ShopBack representative to begin testing after both Step 1 and 2 are completed