Help Centre

<

Home
Tracking product purchases

Bespoke platform integration

Salesfire integrates with any eCommerce platform, working alongside your existing setup to harness the latest in website personalisation.

Salesfire can integrate into your bespoke website quickly and easily with the ability to install through Google Tag Manager. If you don’t use GTM, follow our below guide for another manual method of integrating Salesfire on a bespoke platform:

  1. Paste the following code after your <head> tag.
<script async src="https://cdn.salesfire.co.uk/code/[YOUR SITE ID].js"></script>

2. Get your Site ID from within the Salesfire Dashboard under Preferences.

Learn more about integrating via Google Tag Manager.

Tracking orders

In most cases, we are able to automatically detect orders if you are using Google Analytics on your order success page. However, in some instances, we are not able to see this data so are unable to track orders immediately.

To help support tracking we have the below example code.

Note: When adding the code to your site, you need to strip out the example data we provide, replacing it with the platform's dynamic values. Without this, we will be unable to track the individual orders and items within them.

Add this code to the checkout success page of your website:

<script>
 window.sfDataLayer = window.sfDataLayer || [];
 window.sfDataLayer.push({
   "ecommerce" : {
       "purchase": {
           "id": "WEB1234",
           "revenue": 75.00,
           "shipping": 5.00,
           "tax": 15.00,
           "currency": "GBP",
           "products":[
               {
                   "sku": "220165",
                   "parent_sku": "220164",
                   "name": "Product Title",
                   "variant": "Colour: Red, Size: Small",
                   "price": 25.00,
                   "quantity": 1,
                   "currency": "GBP"
               },
               {
                   "sku": "220166",
                   "parent_sku": "220164",
                   "name": "Product Title",
                   "variant": "Colour: Red, Size: Large",
                   "price": 25.00,
                   "quantity": 2,
                   "currency": "GBP",
                   "position": 1
               }
           ]
        }
     }
 });
</script>

The data layer

<script>
  window.sfDataLayer = window.sfDataLayer || [];
  window.sfDataLayer.push({
    "ecommerce" : {
       
      }
  });
</script>

Everything is added within the opening script tag and array as per the above snippet. We build on this by adding the purchase information within the eCommerce section and then adding the product data within the purchase section.

Purchase information

<script>
 window.sfDataLayer = window.sfDataLayer || [];
 window.sfDataLayer.push({
   "ecommerce" : {
       "purchase": {
           "id": "WEB1234",
           "revenue": 75.00,
           "shipping": 5.00,
           "tax": 15.00,
           "currency": "GBP",
           "products":[

           ]
        }
     }
 });
</script>

This section contains the monetary run through of the order to enable us to track order value. Below, we have given a brief description of each individual field in the purchase section of the data layer.

Field Definitions

  • id (Required) - The unique ID of the transaction. We log the order against this ID and use the unique ID to identify and remove duplicate orders.

    "id": "WEB1234",
  • Revenue (Required) - The revenue generated by this order. You can include or exclude shipping and tax, this figure is what is reflected within Salesfire.

    "revenue": 75.00,
  • Shipping (Not Required) - The value of shipping which was charged on the order. 

    "shipping": 5.00,
  • Tax (Not Required) -  The amount of VAT applicable to the order.

    "tax": 15.00,
  • Currency (Not required) -  The currency of this order. Defaults to GBP if it isn’t included.

    "currency": "GBP",
  • Products (Not required) - An array of products ordered. We use this for additional functionality with product purchase tracking information for some of our tools. See product section below.

    "products":[

    ]  
  • Coupon (Not required) - The coupon or discount code(s) applied to this order. If there are a multiple, use a comma separated list. 

    "coupon": "DISCOUNT-CODE",
  • City (Not Required) - The city of the customer.

    "city": "London",
  • State (Not required) - The state, county or region of the customer.

    "state": "Greater London",
  • Country (Not required) - The two letter code that represents the country of the customer.

    "country": "UK",

Product information

<script>
 window.sfDataLayer = window.sfDataLayer || [];
 window.sfDataLayer.push({
   "ecommerce" : {
       "purchase": {
           "id": "WEB1234",
           "revenue": 75.00,
           "shipping": 5.00
           "tax": 15.00,
           "currency": "GBP",
           "products":[
               {
                   "sku": "220165",
                   "parent_sku": "220164",
                   "name": "Product Title",
                   "variant": "Colour: Red, Size: Small",
                   "price": 75.00,
                   "quantity": 1,
                   "currency": "GBP"
               }
           ]
        }
     }
 });
</script>

This section contains the data related to the individual products purchased as part of the order. Below, we have given a brief description of each individual field in the purchase section of the data layer. 

Field definitions

  • sku (Required) -  This is the product variant ID or SKU on the order. Please note: This must match what is in your product feed.

    "sku": "220165",
  • Parent_sku  (Required)- This is the main product ID, not the variation. Please note: This must match what is in your product feed.

    "parent_sku": "220164",
  • Name (Not required) - The name of the parent product. E.g. short sleeved t-shirt

    "name": "Product Title",
  • Variant (Not required) - The variation name. E.g. colour: red, size: small 

    "variant": "Colour: Red, Size: Small",
  • Price (Not required) - The price of the product excluding tax.

    "price": 75.00,
  • Quantity (Not required) - The quantity of the product that was purchased

    "quantity": 1
  • Currency (Not required) - The currency code of the price. E.g. GBP, USD etc

    "currency": "GBP",
  • Brand (Not required) - The brand name of the product. 

    “brand”: “Gucci”,
  • Category (Not required) - A list of the categories that the product appears in. For nested categories, separate each category by >. For multiple categories, separate via a comma.

    “category”: “Parent Category > Sub Category, Parent Category 2 > Sub Category”,