Universal Tracking (Alternative)


ShopBack uses TUNE Hasoffers for direct integration tracking. For ShopBack's universal tracking solution for most web-based e-commerce solutions, TUNE's Javascript SDK offers the most comprehensive solution for a diverse range of applications. More information can be found here, Universal Tracking.


On the rare chance another analytics partner or affiliate network is also using the TUNE Javascript SDK which will present clashing issues, please use the guide below for an alternative integration method.

Step 1. Adding the Order Tracking Code

  • This step tracks the transaction_id appended to the link when redirecting to the merchant website.
  • 🚧

    To track channel affiliation, ShopBack will be utilizing utm_source=shopbackas a partner affiliation parameter

  • 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.
$(document).ready(function () {
  var url_string = window.location.href;
  var url = new URL(url_string);
  var source = url.searchParams.get("utm_source");
  var transaction = url.searchParams.get("transaction_id");
  if (source == "shopback") {
    localStorage.setItem("utm_source", source);
    localStorage.setItem("transaction_id", transaction);

Step 2: Adding the Conversion Code - Order Tracking

  • This snippet is used to convert user purchases and send the purchase information to ShopBack.
  • The snippet below is for Order Tracking only.
  • Please add the following code snippet below to the checkout page only


function postbackSBHO () {
    var sessionID = sessionStorage.getItem("transaction_id");
    var affiliate = sessionStorage.getItem("utm_source");

    //Define variables
    var adv_sub = "{{ customer_facing_order_id }}";
    var amount = "{{ order_total }}";

    if (sessionID != "undefined" || sessionID != undefined && affiliate == "shopback") {
        var url = "https://shopback.go2cloud.org/aff_lsr?transaction_id=" + sessionID +
        "&adv_sub=" + encodeURI(adv_sub) +
        "&amount=" + amount
    var fetchResponse = fetch(url)
        .then(response => { console.log(response) })
        .catch(error => { console.log(error) })



The merchant is required to replace variables in Line 6 with corresponding parameter values or macros

For any additional code changes or adding extra parameters, you will be required to edit the corresponding postback URL in Line 11

List of code changes:

  • Define variables in Line 6.
  • Edit postback URL in Line 11 to contain variables from Line 6.