E-Commerce Tracking in Google Universal Analytics – Complete Guide

 

Index

E-commerce Tracking Basics

  1. E-commerce Overview report
  2. The 11 E-commerce metrics you must know about in great detail
  3. What is E-commerce Conversion Rate and how it is calculated?
  4. What is a Transaction?
  5. What is Revenue & how it is calculated?
  6. What is Average Order Value and how it is calculated?
  7. What is Unique Purchase?
  8. What is Quantity?
  9. What is Average Quantity and how it is calculated?
  10. What is Product SKU?
  11. What is Average Price and how it is calculated?
  12. What is Product Revenue and how it is calculated?
  13. What is Per Visit Value and how it is calculated?
  14. Where you can track e-commerce metrics in Google Analytics?
  15. What e-commerce data is made up of?
  16. What is transaction Data?
  17. What is item Data?
  18. E-commerce Platforms and their role in E-commerce tracking
  19. How E-commerce Tracking Works?

 

E-commerce Tracking in Google Analytics

  1. What e-commerce tracking code is made up of in Google Analytics?
  2. What is _addTrans() method?
  3. What is _addItem() method?
  4. What is _trackTrans() method?
  5. Example of an E-Commerce Tracking Code in Google Analytics
  6. Setting up E-Commerce Tracking in Google Analytics

 

E-commerce Tracking in Universal Analytics

  1. What e-commerce tracking code is made up of in Universal Analytics?
  2. What is ‘ecommerce’ command?
  3. What is ‘ecommerce:addTransaction’ command?
  4. What is ‘ecommerce:addItem’ command?
  5. What is ‘ecommerce:send’ command?
  6. Example of an E-Commerce Tracking Code in Universal Analytics
  7. How e-commerce tracking works in Universal Analytics?
  8. Setting up E-Commerce Tracking in Universal Analytics

 

Enhanced E-commerce Tracking in Universal Analytics

  1. Understanding Enhanced Ecommerce tracking in Universal Analytics

  2. Implementing Enhanced Ecommerce tracking in Universal Analytics – Nerd Guide


E-commerce Overview report

This is the first report you see in the e-commerce section of your Google Analytics account:

ecommerce overview

The e-commerce overview report (under Conversions > Ecommerce) provides overview of various e-commerce activities on your website.

This overview includes:

  1. Your website ecommerce conversion rate.
  2. Total number of transactions (or orders) placed on your website.
  3. Total revenue generated.
  4. Average order value (average value of an order placed on your website).
  5. Total number of unique purchases.
  6. Total products sold.
  7. Top sources which generated revenue on your website. These sources are top 10 products, top 10 product SKU, top 10 product categories and top 10 traffic sources.
  8. List of top 10 products which sold the most on your website.

 

The 11 E-commerce metrics you must know about in great detail

  1. E-commerce Conversion Rate
  2. Transaction
  3. Revenue
  4. Average Order Value
  5. Unique Purchases
  6. Quantity
  7. Average Quantity
  8. Product SKU
  9. Average Price
  10. Product Revenue
  11. Per Visit Value

 

1. What is E-commerce Conversion Rate and how it is calculated?

E-commerce conversion rate is the percentage of visits which results in e-commerce transactions.

E-commerce conversion rate = (Total E-Commerce Transactions/Total visits on a website) * 100

For e.g. the e-commerce conversion rate in the chart above was calculated as:

= (17,102 transactions / 820,476 visits) * 100 = 2.08%

 

2. What is a Transaction?

Transaction (or e-commerce transaction) is a purchase order.

For example 17,102 transactions means 17,102 purchase orders were placed on the website.

The e-commerce overview report shows the total number of transactions carried out on the website (which is 17,102) in a specified time period.

Each transaction is identified through a unique ID known as transaction ID.

A transaction ID may look something like: 303403145109193

A single transaction can include several products or several units of same product as a person can buy several products in one transaction or several units of a same product in one transaction.

For example, a person can buy Iphone and a Ipad in a single transaction or a person can buy 10 units (or pieces) of Iphone and 2 units of Ipad in a single transaction.

  

3. What is Revenue & how it is calculated?

total revenue

The revenue that you see in the ‘e-commerce overview report’ is the total revenue.

Total Revenue = Total Product Revenue + Total Tax + Total Shipping

For example, the total revenue in the ‘e-commerce overview report’ was calculated as:

Total Revenue = $3,701,278.00 (total product revenue) + $208,063.96 (total tax) + $1,274.95 (total shipping) = $3,910,616.91

Your total revenue figure in Ecommerce overview report depends upon how your client has set up ecommerce tracking.

If your client decided to exclude tax and shipping amount from the total revenue, then your total revenue and product revenue amount would be the same.

If the tax information and/or shipping information is not supplied while setting up e-commerce tracking then Google Analytics can’t report such information in its reports and they won’t be included in the computation of total revenue.

 

4. What is Average Order Value and how it is calculated?

Average value or average order value (AOV) is the average value of an e-commerce transaction.

Average Value = Total Revenue/Total Transactions

For example, the AOV in the chart above was calculated as:

AOV = $3,910,616.91 / 17102 = $228.66

 

5. What is Unique Purchase?

Unique purchase is the total number of times a product or a set of products was a part of a transaction. 

unique purchases

unique purchases2

Note: The total unique purchases of a product is not equal to total number of units sold for a product in one transaction.

For example, the total unique purchases of the first product is 4,958. But many people wrongly assume that 4,958 units of the first product were sold in one transaction.

But this is not the case.

The 4,958 figure tells you that the first product was a part of a transaction 4,958 times. It doesn’t tell you the number of units sold for the product in one transaction.

 

In order to find out how many units of a product were sold in one transaction, follow the steps below:

  1. Click on a product link in the ‘Product Performance’ report (under Conversions > Ecommerce).
  2. Add ‘transaction’ as a ‘secondary dimension.

You will see a report like the one below:

unique purchases3

From the report above we can conclude following:

  • 1 unit of the first product was sold in one transaction (with the transaction ID ending with 548456)
  • 1 unit of the first product was sold in one transaction (with the transaction ID ending with 559331)
  • 2 units of the first product was sold in one transaction (with the transaction ID ending with 5226). In other words, someone bought 2 units of the first product in one transaction.

 

6. What is Quantity?

Quantity is the total number of units sold for a product or set of products.

quantity

 

7. What is Average Quantity and how it is calculated?

Average quantity is the average number of units sold for a product or set of products in one transaction.

average quantity

Average Quantity = Quantity / Unique Purchases

For example:

  • The average quantity of set of products is calculated as: 45226/24051 = 1.88
  • The average quantity of 1st product is calculated as: 13,281/4958 = 2.68
  • The average quantity of 2nd product is calculated as: 4082/3042 = 1.34

 

8. What is Product SKU?

Stock keeping unit or SKU is a product code which is used to uniquely identify a product.

product sku

Following are some of the examples of SKU: HCS3245H, DB45TH, R567, 156781 etc

  

9. What is Average Price and how it is calculated?

Average price is the average price of a product or set of products. 

average price

Average price of a set of products = Total Product Revenue / Total Quantity = $3,701,278.00 / 45,226 = $81.84

Average price of the first product = Revenue for the first product / Quantity of the first product = $1,049,199.00 / 13,281 = $79.00

 

10. What is Product Revenue and how it is calculated?

 Product revenue is the total revenue generated from a product or a set of products.

product revenue

Product Revenue = Quantity * Average Price

Here,

Total Revenue generated from a set of products is calculated as: 45,226 * $81.84 = $3,701,278.00

Total Revenue generated from the first products is calculated as: 13,281 * $79.00 = $1,049,199.00

Note: Product revenue doesn’t include tax and shipping charges.

 

11. What is Per Visit Value and how it is calculated?

Per visit value is the average value of a visit to your e-commerce website.

per visit value

Per visit value = Total Revenue / Total Visits

For example, in the chart above,

The per visit value of all traffic sources is calculated as: $3,428,668.51 / 703,794 = $4.87

The per visit value of the traffic from Google Organic is calculated as: $1,210,435.12 / 210,317 = $5.76

Higher the per visit value, more valuable the traffic is for your e-commerce business. 

Note: You can determine per visit value of a traffic source through ‘Ecommerce’ Tabs found in various reports.

 

Where you can track e-commerce metrics in Google Analytics?

You can track e-commerce metrics in various ‘E-Commerce’ reports and through the ‘Ecommerce’ tabs found in almost all reports in GA/UA like ‘All Traffic’ report.

e-commerce

 

What e-commerce data is made up of?

It is made up of transaction data and item data.

 

What is transaction Data?

Transaction Data provide details about visitor’s transactions like:

  1. Transaction ID (or order ID)
  2. Store or affiliation name
  3. Total revenue generated from the transaction
  4. Tax
  5. Shipping Charges
  6. Transaction City
  7. Transaction State/Region
  8. Transaction Country

 

What is item Data?

Item data provides details about a purchased product like:

  1. Transaction ID (same as in the transaction data)
  2. Product SKU (or product code)
  3. Product Name
  4. Product Category/Variation
  5. Product Price
  6. Product Quantity

 

What e-commerce tracking code is made up of in Google Analytics?

It is made up of three methods:

  1. _addTrans()
  2. _addItem()
  3. _TrackTrans()

 

What is _addTrans() method?

This method is used to create visitor’s transaction and to store all the information about the transaction.

Syntax: _addTrans(orderID, storeName, total, tax, shipping, city, state, country)

Example:

 

What is _addItem() method?

This method is used to add a product to visitor’s transaction and to store all the information about the purchased product.

Syntax: _addItem(orderID, Product-SKU, Product-Name, Product-Category, Product-Price, Quantity)

Example:

 

What is _trackTrans() method?

This method is used to send all the e-commerce data to Google Analytics server.

The data is sent via invisible _utm.gif file.

This file is requested once for each visitor’s transaction and once for each unique product (product SKU) in the transaction.

So if there are 4 unique products in a visitor’s transaction (i.e. the person has bought 4 unique products in one transaction) then there will be 5 requests for _utm.gif file.

Syntax:  _gaq.push([‘_trackTrans’]);

Note: The _trackTrans() method should always be called after following methods: _trackPageView(), _addTrans() and _addItem() methods.

 

Example of an E-Commerce Tracking Code in Google Analytics

_gaq.push([‘_addTrans’,

‘1234’,

‘skinny jeans’,

’28.8’,

‘1.89’,

’10.00’,

‘Los Angeles’,

‘California’,

‘USA’

]);

 

_gaq.push([‘_addItem’,

‘1234’,

‘SKJ49’,

’OKE Jeans’,

‘Men Jeans’,

’76.75’,

‘1’,

]);

_gaq.push([‘_trackTrans’]);

 

E-commerce Platforms and their role in E-commerce tracking

There are two types of e-commerce platforms: Pre-built and Custom made

Many business owners/webmasters use pre-built e-commerce platforms like ‘Magento’ to build and manage their online stores. These platforms are hosted on the service provider’s web servers.

While many others choose to use custom made e-commerce platforms in order to get more control on their shopping cart experience and to keep everything in-house. These platforms are often hosted on the web server which host your website.

e-commerce platform

You need an e-commerce platform to collect, process, store and manage e-commerce data.

Almost all pre-built e-commerce platforms provide integration with Google Analytics. Platforms which don’t provide such integration should be avoided at all cost.

Once your e-commerce platform has been integrated with Google Analytics, it can send e-commerce data to Google Analytics server, thus allowing you to analyse and correlate e-commerce data with website usage metrics (like visits, bounce rate etc) in Google Analytics reports.

Following are some of the most popular pre-built e-commerce platforms:

  1. Os Commerce
  2. Zen-Cart
  3. Magento
  4. Big Commerce
  5. Shopify
  6. Volusion

 

How E-commerce Tracking Works?

how ecommerce tracking works

1. A website visitor completes a transaction.

2. Your e-commerce platform:

  • processes the transaction (verify credit card details etc)
  • stores transaction details
  • creates a receipt page (generally ‘thank you’ page)
  • insert e-commerce date into ‘Google Analytics E-commerce tracking code’
  • sends receipt page to the visitor’s web browser.

3.  As soon as the page is loaded into the visitor’s browser, the Google Analytics Ecommerce tracking code is executed which then sends the e-commerce data to Google Analytics server. 

 

Setting up E-Commerce Tracking in Google Analytics

Step 1: Create your Google Analytics account (if you already don’t have one).

Step-2: Integrate your e-commerce platform/shopping cart software with Google Analytics. So that your ecommerce platform/shopping cart can send ecommerce data to Google Analytics. This often includes adding Google analytics tracking code, E-commerce tracking code and some server side script like (PHP, ASP etc) to your shopping cart receipt page (generally the ‘thank you’ page).

Step-3: Enable e-commerce reporting in your Google Analytics Profile/View. More details here.

Step-4: Set up a funnel for checkout process in Google Analytics. To do this, first determine all of the webpages which make up your shopping cart funnel. To learn more about setting up funnels in GA, check out this article: The Geek Guide to Understanding Funnels in Google Analytics

Note: Make sure that website visitors can’t access the shopping cart receipt page directly without first making a purchase. Otherwise your e-commerce stats will be skewed. 

 

What e-commerce tracking code is made up of in Universal Analytics?

It is made up of following four commands:

  1. ecommerce
  2. ecommerce:addTransaction
  3. ecommerce:addItem
  4. ecommerce:send

 

What is ‘ecommerce’ command?

This command is used to load the ecommerce plugin.

This plugin contains the functionality for e-commerce tracking in UA.

Note: Your ecommerce tracking will not work if you forget to load the ecommerce plugin.

Syntax: ga(‘require’, ‘ecommerce’, ‘ecommerce.js’);

Note: The ‘ecommerce’ command should always be called after you have created the tracker object and before following commands are executed: ecommerce:addTransaction, ecommerce:addItem and ecommerce:send

 

What is ‘ecommerce:addTransaction’ command?

This command is used to create visitor’s transaction and to store all the information about the transaction.

Syntax: ga(‘ecommerce:addTransaction’, {
‘id': ‘1234’, // Transaction ID. Required.
‘affiliation': ‘skinny jeans’, // store name.
‘revenue': ‘28.8’, // total revenue.
‘shipping': ‘10.00’, // Shipping.
‘tax': ‘1.89’ // Tax.
});

 

What is ‘ecommerce:addItem’ command?

This command is used to add a product to visitor’s transaction and to store all the information about the purchased product.

Syntax: ga(‘ecommerce:addItem’, {
‘id': ‘1234’, // Transaction ID. Required. Same as in the transaction data.
‘name': ‘OKEJeans’, // Product name. Required.
‘sku': ‘SKJ49′, // Product SKU.
‘category': ‘Men Jeans’, // Product Category or variation.
‘price': ‘76.65’, // Product price.
‘quantity': ‘1’ // Product Quantity.
});

 

What is ‘ecommerce:send’ command?

This command is used to send all the e-commerce data to Universal Analytics server.

Syntax: ga(‘ecommerce:send’);

 

Example of an E-Commerce Tracking Code in Universal Analytics

ga(‘require’, ‘ecommerce’, ‘ecommerce.js’);
ga(‘ecommerce:addTransaction’, {
‘id': ‘1234’, // Transaction ID. Required.
‘affiliation': ‘skinny jeans’, // store name.
‘revenue': ‘28.8’, // total revenue.
‘shipping': ‘10.00’, // Shipping.
‘tax': ‘1.89’ // Tax.
});
ga(‘ecommerce:addItem’, {
‘id': ‘1234’, // Transaction ID. Required. Same as in the transaction data.
‘name': ‘OKEJeans’, // Product name. Required.
‘sku': ‘SKJ49′, // Product SKU.
‘category': ‘Men Jeans’, // Product Category or variation.
‘price': ‘76.65’, // Product price.
‘quantity': ‘1’ // Product Quantity.
});
ga(‘ecommerce:send’);

 

How e-commerce tracking works in Universal Analytics?

In general the ecommerce tracking in Universal Analytics works in the same way as it works in Google Analytics.

 

Setting up E-Commerce Tracking in Universal Analytics

Step 1: Create your Universal Analytics account (if you already don’t have one).

Step-2: Integrate your e-commerce platform with Universal Analytics. So that your e-commerce platform can send e-commerce data to Universal Analytics.

Step-3: Enable e-commerce reporting in your Universal Analytics Profile/View.

Step-4: Set up a funnel for checkout process in Universal Analytics.

 

<Bonus Content>

Frequently Asked questions about E-commerce Tracking in Google Analytics

Tweet to read the bonus content.


 

< /End of Bonus Content>

This post is the third in the series of frequently asked questions about various issues in Google Analytics.

The first post in the series was How Google Analytics Uses Cookies which talks about Google Analytics cookies in great details.

The second post in the series was How Cross Domain tracking works in Google Analytics which talks about cross domain tracking in great detail.

 

Other Posts you may find useful:

 

Subscribe to my blog
Join my free newsletter and learn to avoid the analytics mistakes everyone seems to be making over and over again.

 

 

About the Author:

Please feel free to endorse/forward my LinkedIn Profile to your clients, colleagues, friends and others you feel would benefit from PPC, Web Analytics or Conversion Optimization.

For any question/comment Contact me