Tracking Product Views

This tracking is required to make use of our Product Views prompt.

You need to insert the following code on product pages and ensure the fields reflect the current product being viewed.

<script>
  window.sfDataLayer = window.sfDataLayer || [];
  window.sfDataLayer.push({
      "ecommerce": {
          "view": {
              "sku": "220165",
              "parent_sku": "220164",
              "name": "Product Title",
              "variant": "Color: Red, Size: Small",
              "price": 25.00, // ex tax price
              "currency": "GBP"
          }
      }
  });
</script>

Field definitions:

  • sku - (required) - this is the product variant ID or SKU. For example, the ID of the blue variant of a t-shirt.
  • parent_sku - (required) - this is the product ID. For example, the ID of a t-shirt product.
  • name - (recommended) - the name of the product.
  • variant - (recommended) - the name of the variant.
  • price - (recommended) - the price of the product excluding tax.
  • currency - (recommended) - the currency of the product's price.

Please not that the sku and parent_sku should match those used in the Order Tracking.

We also support the following but are optional:

  • brand - (optional) - the name of the brand.
  • category - (optional) - a comma separated list of categories. Nested categories should be denoted by a >.