Customer Tracking

This post is also available in: Czech

In the following article, we will show you how to set up customer tracking on your website by connecting Samba and the Upgates platform.

Tracking code

In order for Samba to be able to track your customers’ purchasing behaviour and then personalize your communication based on this data, you need to have this tracking script on your website:

<!-- Samba.ai pixel -->
<script async src="https://yottlyscript.com/script.js?tp=YOUR_TRACKPOINT_ID"></script>
<script>

if (upgates.cookies.personalized) {

var _yottlyOnload = _yottlyOnload || []
_yottlyOnload.push(function () {
  if (upgates.customer) {
    diffAnalytics.customerLoggedIn('C' + String(upgates.customer.id).padStart(5, '0'));
  }

  let cartContent = upgates.cart.products.map(function (cartItem) {
    return { productId: cartItem.code, amount: cartItem.quantity };
  });
  diffAnalytics.cartInteraction({ content: cartContent, onOrderPage: ['order.checkout','order.recieved','order.summary'].indexOf(upgates.pageType) !== -1 });

  if (upgates.pageType === 'order.recieved') {
    let orderContent = upgates.order.products.map(function (orderItem) {
      return { productId: orderItem.code, price: orderItem.price.withVat * orderItem.quantity };
    });
    diffAnalytics.order({ content: orderContent });
  }

  if (upgates.pageType === 'product') {
    diffAnalytics.productId(upgates.product.code);
  }
});
}
</script>
<!-- End Samba.ai pixel -->
Trackpoint ID

Attention! It is important to replace *YOUR_TRACKPOINT_ID* it with the numeric value of your TrackPoint, which you can find in Samba → Eshop Settings → Overview

Embedding code into the site

The above-mentioned script must be inserted into the administration of your eshop in Upgates.

In the left sidebar, open the Addons section and go to the Custom Conversion Codes.

Here, paste the entire script into the Code placed before the tag </body> in the </> Codes placed on all pages section and save the settings.

This post is also available in: Czech

Updated on November 1, 2022

Was this article helpful?

Related Articles