How to Set Up eCommerce Statistics

Installing eCommerce Event Triggers

About this Guide

This guide explains how eCommerce Statistics can be set up to analyze customer behavior and store performance, which is made possible by collecting data on webstore visitor events. It lists all the events important to eCommerce businesses, and explain how the event tags can be created and added to the webstore so that eCommerce Statistics can build this data into its analytics.

For more advice on this module, please visit the Support Center.

Visit the eCommerce Statistics Support Center


Tip: We highly recommend that you make use of all the eCommerce events covered below so that the analytics toolkit runs at full capacity.

Inside this Guide

Before Setting Up eCommerce Statistics

Before setting up eCommerce Statistics, ensure that structural setup has been completed for the wider website intelligence toolkit.

This means opening an account and installing the tracking code that fuels it with website data. We also advise that you set the privacy level so that data collection happens within your legal data threshold and that the account is set to the right currency in Module Settings.

Everything else can be done after actioning the eCommerce Statistics calibration steps that follow, and we've written a comprehensive guide on getting started with the platform if you need some help.

Read the Guide: How to Get Started


How eCommerce Statistics Works

When an analytics tool is native to an eCommerce webstore builder, it shares the infrastructure required to provide intelligence without much backend calibration. Others - like this platform - need JavaScript code inserted into the html of predetermined webpage elements so that they can collect the data needed to provide eCommerce analytics.

These JavaScript snippets are therefore called eCommerce event tags, and they work in the same way as Event Tracking tags. Each tag is made up of identifying parameters that enable eCommerce Statistics to segment and analyze data around key user business characteristics.

Setting up this tool therefore means understanding what the different eCommerce events are, the technical parameters that make up each tag, how to create them, and how to then install the tags into the relevant webpage element's JavaScript code.


Note: eCommerce Statistics is part of a wider website intelligence toolkit. This means users will be getting reports on store performance away from interactions related to product sales, basket activity, and the full checkout process from the moment they've installed the tracking code.

Visit the eCommerce Statistics Support Center


Building eCommerce Event Tags

Custom tags need to be created for all these different website visitor actions, and they then need to be integrated correctly into the relevant webpage element's JavaScript.

But at the heart of these actions are the products or services you sell. Many of these will share similar characteristics, making it important to take a strategic approach to the custom parameters included in each tag. You can represent these as an array of item categories. A maximum of 27 custom parameters can be included in the item categories array, in addition to the prescribed ones.

The example below demonstrates how you can create an eCommerce event tag. Up to 200 of these items can be included in each.

"items":[
    {
      "id": "XYZ_123",
      "item_name": "GPCE Inception™ Maple",
      "affiliation": "Online Guitar Range",
      "coupon": "50%OFF",
      "discount": 3,
      "index": 0,
      "item_brand": "Martin",
      "item_category": "Acoustic",
      "item_category2": "Right-Handed",
      "item_category3": "Side Material Maple",
      "item_category4": "Finish Material Satin",
      "item_category5": "Neck Shape Modified Low Oval",
      "item_list_id": "related-products",
      "item_list_name": "Related Products",
      "item_variant": "New in 2024",
      "location_id": "Online shop #2",
      "price": 3999.99,
      "quantity": 1
    }
  ]
})
		

Three Essential Tag Parameters

<h4>eComm Identifier</h4> <p>By including "ecom" in the event tag, our website intelligence platform will recognize the tag as relating to an eCommerce event.</p>

eComm Identifier

By including "ecom" in the event tag, our website intelligence platform will recognize the tag as relating to an eCommerce event.

<h4>Event Type</h4> <p>The eCommerce event tag you're creating will need to specify which of the 16 current eCommerce event categories it relates to.</p>

Event Type

The eCommerce event tag you're creating will need to specify which of the 16 current eCommerce event categories it relates to.

<h4>Event Payload</h4> <p>This includes elements such as transaction ID, item details, shipping, or any custom parameters specific to your eCommerce setup.</p>

Event Payload

This includes elements such as transaction ID, item details, shipping, or any custom parameters specific to your eCommerce setup.


Our 16 eCommerce Statistics Events

Selecting an Item From a List

#1 view_item_list

When a user is provided with a list of results, send a view_item_list event that includes an items array parameter with the displayed items. For more information on the precise parameters to include, jump to the specific event on our eCommerce Statistics Events Support page.


va('ecom','view_item_list',{
  "customer": {
    "id": "internalID",
    "name": "John Smith",
    "email": "john@smith.com",
    "phoneNumber": "+4012312312312" 
  },
  "term": "Item List Name",
  "currency":"RON",
  "value":0.00,
  "items":[
    {
      "id": "SKU_123",
      "item_name": "iPhone 15",
      "affiliation": "Magazin online #1",
      "coupon": "50%OFF",
      "discount": 10,
      "index": 0,
      "item_brand": "Apple",
      "item_category": "Category 1",
      "item_category2": "Category 2",
      "item_category3": "Category 3",
      "item_category4": "Category 4",
      "item_category5": "Category 5",
      "item_list_id": "LIST-123",
      "item_list_name": "John's wishlist",
      "item_variant": "Sky Blue",
      "location_id": "Online shop #2",
      "price": 6512.30,
      "quantity": 1,
      "image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
    }
  ]
})
		

Viewing Item Details

#2 view_item

To track how many times an item is viewed, send a view_item event whenever a webstore visitor views an item. For more information on the precise parameters to include, jump to the specific event on our eCommerce Statistics Events Support page.


va('ecom','view_item',{
  "customer": {
    "id": "internalID",
    "name": "John Smith",
    "email": "john@smith.com",
    "phoneNumber": "+4012312312312" 
  },
  "currency":"RON",
  "value":0.00,
  "items":[
    {
      "id": "SKU_123",
      "item_name": "iPhone 15",
      "affiliation": "Magazin online #1",
      "coupon": "50%OFF",
      "discount": 10,
      "index": 0,
      "item_brand": "Apple",
      "item_category": "Category 1",
      "item_category2": "Category 2",
      "item_category3": "Category 3",
      "item_category4": "Category 4",
      "item_category5": "Category 5",
      "item_list_id": "LIST-123",
      "item_list_name": "John's wishlist",
      "item_variant": "Sky Blue",
      "location_id": "Online shop #2",
      "price": 6512.30,
      "quantity": 1,
      "image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
    }
  ]
})
		

Adding or Removing Item From a Cart

#3 add_to_cart

To track when an item is added to a shopping card, send an add_to_cart event with the relevant item categories included. For more information on the precise parameters to include, jump to the specific event on our eCommerce Statistics Events Support page.


va('ecom','add_to_cart',{
  "customer": {
    "id": "internalID",
    "name": "John Smith",
    "email": "john@smith.com",
    "phoneNumber": "+4012312312312" 
  },
  "currency":"RON",
  "value":0.00,
  "items":[
    {
      "id": "SKU_123",
      "item_name": "iPhone 15",
      "affiliation": "Magazin online #1",
      "coupon": "50%OFF",
      "discount": 10,
      "index": 0,
      "item_brand": "Apple",
      "item_category": "Category 1",
      "item_category2": "Category 2",
      "item_category3": "Category 3",
      "item_category4": "Category 4",
      "item_category5": "Category 5",
      "item_list_id": "LIST-123",
      "item_list_name": "John's wishlist",
      "item_variant": "Sky Blue",
      "location_id": "Online shop #2",
      "price": 6512.30,
      "quantity": 1,
      "image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
    }
  ]
})
		

#4 add_to_wishlist

Additionally, you can monitor when a product is added to a wishlist by sending an add_to_wishlist event with the relevant items in an items array. For more information on the precise parameters to include, jump to the specific event on our eCommerce Statistics Events Support page.


va('ecom','add_to_wishlist',{
  "customer": {
    "id": "internalID",
    "name": "John Smith",
    "email": "john@smith.com",
    "phoneNumber": "+4012312312312" 
  },
  "currency":"RON",
  "value":0.00,
  "items":[
    {
      "id": "SKU_123",
      "item_name": "iPhone 15",
      "affiliation": "Magazin online #1",
      "coupon": "50%OFF",
      "discount": 10,
      "index": 0,
      "item_brand": "Apple",
      "item_category": "Category 1",
      "item_category2": "Category 2",
      "item_category3": "Category 3",
      "item_category4": "Category 4",
      "item_category5": "Category 5",
      "item_list_id": "LIST-123",
      "item_list_name": "John's wishlist",
      "item_variant": "Sky Blue",
      "location_id": "Online shop #2",
      "price": 6512.30,
      "quantity": 1,
      "image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
    }
  ]
})
		

#5 view_cart

And when a visitor then views their shopping cart, send the view_cart event with all items in the cart. For more information on the precise parameters to include, jump to the specific event on our eCommerce Statistics Events Support page.


va('ecom','view_cart',{
  "customer": {
    "id": "internalID",
    "name": "John Smith",
    "email": "john@smith.com",
    "phoneNumber": "+4012312312312" 
  },
  "currency":"RON",
  "value":0.00,
  "items":[
    {
      "id": "SKU_123",
      "item_name": "iPhone 15",
      "affiliation": "Magazin online #1",
      "coupon": "50%OFF",
      "discount": 10,
      "index": 0,
      "item_brand": "Apple",
      "item_category": "Category 1",
      "item_category2": "Category 2",
      "item_category3": "Category 3",
      "item_category4": "Category 4",
      "item_category5": "Category 5",
      "item_list_id": "LIST-123",
      "item_list_name": "John's wishlist",
      "item_variant": "Sky Blue",
      "location_id": "Online shop #2",
      "price": 6512.30,
      "quantity": 1,
      "image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
    }
  ]
})
		

#6 remove_from_cart

To track when a visitor removes an item from their cart, send the remove_from_cart event. For more information on the precise parameters to include, jump to the specific event on our eCommerce Statistics Events Support page.


va('ecom','remove_from_cart',{
  "customer": {
    "id": "internalID",
    "name": "John Smith",
    "email": "john@smith.com",
    "phoneNumber": "+4012312312312" 
  },
  "currency":"RON",
  "value":0.00,
  "items":[
    {
      "id": "SKU_123",
      "item_name": "iPhone 15",
      "affiliation": "Magazin online #1",
      "coupon": "50%OFF",
      "discount": 10,
      "index": 0,
      "item_brand": "Apple",
      "item_category": "Category 1",
      "item_category2": "Category 2",
      "item_category3": "Category 3",
      "item_category4": "Category 4",
      "item_category5": "Category 5",
      "item_list_id": "LIST-123",
      "item_list_name": "John's wishlist",
      "item_variant": "Sky Blue",
      "location_id": "Online shop #2",
      "price": 6512.30,
      "quantity": 1,
      "image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
    }
  ]
})

		

#7 remove_from_wishlist

And to track when a visitor removes an item from their wishlist, send the remove_from_wishlist event. Fore more information on the precise parameters to include, jump to the specific event on our eCommerce Statistics Events Support Page.


va('ecom','remove_from_wishlist',{
  "customer": {
    "id": "internalID",
    "name": "John Smith",
    "email": "john@smith.com",
    "phoneNumber": "+4012312312312" 
  },
  "currency":"RON",
  "value":0.00,
  "items":[
    {
      "id": "SKU_123",
      "item_name": "iPhone 15",
      "affiliation": "Magazin online #1",
      "coupon": "50%OFF",
      "discount": 10,
      "index": 0,
      "item_brand": "Apple",
      "item_category": "Category 1",
      "item_category2": "Category 2",
      "item_category3": "Category 3",
      "item_category4": "Category 4",
      "item_category5": "Category 5",
      "item_list_id": "LIST-123",
      "item_list_name": "John's wishlist",
      "item_variant": "Sky Blue",
      "location_id": "Online shop #2",
      "price": 6512.30,
      "quantity": 1,
      "image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
    }
  ]
})
		

Initiating the Checkout Process

#8 begin_checkout

The checkout process has various stages that need to be tagged. Start by sending a begin_checkout event with one or more items defined with the relevant fields. A discount code can also be added at this stage to the entire order by adding it to the event or applied to a particular item by adding it to specific elements in the items array. For more information on the precise parameters to include, jump to the specific event on our eCommerce Statistics Events Support page.


va('ecom','begin_checkout',{
  "customer": {
    "id": "internalID",
    "name": "John Smith",
    "email": "john@smith.com",
    "phoneNumber": "+4012312312312" 
  },
  "currency":"RON",
  "value":0.00,
  "coupon": "DISCOUNT CODE",
  "items":[
    {
      "id": "SKU_123",
      "item_name": "iPhone 15",
      "affiliation": "Magazin online #1",
      "coupon": "50%OFF",
      "discount": 10,
      "index": 0,
      "item_brand": "Apple",
      "item_category": "Category 1",
      "item_category2": "Category 2",
      "item_category3": "Category 3",
      "item_category4": "Category 4",
      "item_category5": "Category 5",
      "item_list_id": "LIST-123",
      "item_list_name": "John's wishlist",
      "item_variant": "Sky Blue",
      "location_id": "Online shop #2",
      "price": 6512.30,
      "quantity": 1,
      "image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
    }
  ]
})
		

#9 add_payment_info

Next, send the add_payment_info event when a visitor inputs their payment details. And if relevant, include payment_type with this event for the chosen method of payment. For more information on the precise parameters to include, jump to the specific event on our eCommerce Statistics Events Support page.


va('ecom', 'add_payment_info', {
  "customer": {
    "id": "internalID",
    "name": "John Smith",
    "email": "john@smith.com",
    "phoneNumber": "+4012312312312" 
  },
  "currency": "RON",
  "value": 0.00,
  "method": "Credit Card"
})
		

#10 add_shipping_info

The next stage is shopping information, Send an add_shipping_info event when a visitor reaches this stage. Also use the parameter shipping_tier to specify the user’s delivery option, such as "DHL”, "Parcel Force", or "Royal Mail". For more information on the precise parameters to include, jump to the specific event on our eCommerce Statistics Events Support page.


va('ecom','add_shipping_info',{
  "customer": {
    "id": "internalID",
    "name": "John Smith",
    "email": "john@smith.com",
    "phoneNumber": "+4012312312312" 
  },
  "currency":"RON",
  "value":0.00,
  "shippingTier":"DHL"
})
		

Making Purchases or Refunds

#11 purchase

To track purchases, send a purchase event that includes one or more items defined within the relevant fields. For more information on the precise parameters to include, jump to the specific event on our eCommerce Statistics Events Support page.


va('ecom','purchase',{
  "customer": {
    "id": "internalID",
    "name": "John Smith",
    "email": "john@smith.com",
    "phoneNumber": "+4012312312312" 
  },
  "transaction_id": "PayPal12312321312",
  "currency": "RON",
  "value": 6502.30,
  "coupon": "DISCOUNT_CODE",
  "shipping":12.50,
  "tax": 850.21,
  "items":[
    {
      "id": "SKU_123",
      "item_name": "iPhone 15",
      "affiliation": "Magazin online #1",
      "coupon": "50%OFF",
      "discount": 10,
      "index": 0,
      "item_brand": "Apple",
      "item_category": "Category 1",
      "item_category2": "Category 2",
      "item_category3": "Category 3",
      "item_category4": "Category 4",
      "item_category5": "Category 5",
      "item_list_id": "LIST-123",
      "item_list_name": "John's wishlist",
      "item_variant": "Sky Blue",
      "location_id": "Online shop #2",
      "price": 6512.30,
      "quantity": 1,
      "image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
    }
  ]
})
		

#12 refund

Track refunds by sending a refund event with the right transaction_id specified, as well as one or more items defined with item_id and quantity. We recommend that you include item information in your refund event to see item-level refund metrics. For more information on the precise parameters to include, jump to the specific event on our eCommerce Statistics Events Support page.


va('ecom','refund',{
  "customer": {
    "id": "internalID",
    "name": "John Smith",
    "email": "john@smith.com",
    "phoneNumber": "+4012312312312" 
  },
  "transaction_id": "PayPal12312321312",
  "currency": "RON",
  "value": 6502.30,
  "coupon": "DISCOUNT_CODE",
  "shipping":12.50,
  "tax": 850.21,
  "items":[
    {
      "id": "SKU_123",
      "item_name": "iPhone 15",
      "affiliation": "Magazin online #1",
      "coupon": "50%OFF",
      "discount": 10,
      "index": 0,
      "item_brand": "Apple",
      "item_category": "Category 1",
      "item_category2": "Category 2",
      "item_category3": "Category 3",
      "item_category4": "Category 4",
      "item_category5": "Category 5",
      "item_list_id": "LIST-123",
      "item_list_name": "John's wishlist",
      "item_variant": "Sky Blue",
      "location_id": "Online shop #2",
      "price": 6512.30,
      "quantity": 1,
      "image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
    }
  ]
})
		

Signups, Logins, Shares, and Lead Generation

#13 sign_up

Track new account signups by creating the sign_up event. For more information on the parameters to include, jump to the specific event on our eCommerce Statistics Events Support page.


va('ecom','sign_up',{
  "customer": {
    "id": "internalID",
    "name": "John Smith",
    "email": "john@smith.com",
    "phoneNumber": "+4012312312312" 
  },
  "method": "Google"
})
		

#14 login

Next, track logins to the webstore by creating the the login event. For more information on the parameters to include, jump to the specific event on our eCommerce Statistics Events Support page.


va('ecom','login',{
  "customer": {
    "id": "internalID",
    "name": "John Smith",
    "email": "john@smith.com",
    "phoneNumber": "+4012312312312" 
  },
  "method": "Basic auth"
})
		

#15 share

Track when any webpages are shared by users by creating the share event. For more information on the parameters to include, jump to the specific event on our eCommerce Statistics Events Support page.


va('ecom','share',{
  "customer": {
    "id": "internalID",
    "name": "John Smith",
    "email": "john@smith.com",
    "phoneNumber": "+4012312312312" 
  },
  "method": "Twitter",
  "items":[
    {
      "id": "SKU_123",
      "item_name": "iPhone 15",
      "affiliation": "Magazin online #1",
      "coupon": "50%OFF",
      "discount": 10,
      "index": 0,
      "item_brand": "Apple",
      "item_category": "Category 1",
      "item_category2": "Category 2",
      "item_category3": "Category 3",
      "item_category4": "Category 4",
      "item_category5": "Category 5",
      "item_list_id": "LIST-123",
      "item_list_name": "John's wishlist",
      "item_variant": "Sky Blue",
      "location_id": "Online shop #2",
      "price": 6512.30,
      "quantity": 1,
      "image_url": "https://www.apple.com/newsroom/images/2023/09/apple-unveils-iphone-15-pro-and-iphone-15-pro-max/tile/Apple-iPhone-15-Pro-lineup-hero-230912.jpg.og.jpg?202309270316"
    }
  ]
})
		

#16 generate_lead

Finally, to track any new lead generation (such as when a customer completes a form), create the generate_lead event. For more information on the parameters to include, jump to the specific event on our eCommerce Statistics Events Support page.


va('ecom','generate_lead',{
  "customer": {
    "id": "internalID",
    "name": "John Smith",
    "email": "john@smith.com",
    "phoneNumber": "+4012312312312" 
  },
  "currency":"RON",
  "value":0.00
})