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. General information on customer tracking can be found in this article.

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 these scripts implemented on your website:

  1. Basic tracking script (SmartPoint) – Copy its exact form from your Samba account in the Settings > Integration section.
  2. Additional tracking scripts
<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>
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 February 15, 2023

Was this article helpful?

Related Articles