Google & Universal Analytics E-Commerce Tracking – 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
  7. Frequently Asked questions about 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

 

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.

 

Frequently Asked questions about E-commerce Tracking in Google Analytics

Q1. Do I need to supply values for all parameters of _addTrans()? 

Yes. Even if some of the parameters have empty value.

Q2. How I can leave the value of a parameter empty?

Just don’t add anything between the quotation marks.For example:

Q3. Do I need to supply values for all parameters of _addItem()?

Yes. Even if some of the parameters have empty value.

Q4. Which parameter of _addItem() method associates a product item with a transaction? 

‘orderID’

Q5. Which parameters I can’t leave empty in _addItem() method?

There are 4 parameters which you can’t leave empty:

  1. OrderID
  2. Product SKU
  3. Product Price
  4. Product Quantity

Q6. What is the advantage of supplying value to ‘product name’ parameter in _additem() method?

By supplying the value you can associate revenue with a product name. If you don’t supply this value then you won’t be able to see revenue generated by the sale of a particular product item in Google Analytics ‘Product Performance’ report.

Q7. When E-Commerce Data in E-Commerce Tracking can cause problem?

It can cause problem if you supply currency identifier (like $, £, € etc) or comma (to separate numbers) in the numeric fields of _addTrans() or _addItem() methods. For example:

Q8. What is the difference between Google Analytics Tracking code (GATC) and E-Commerce Tracking code?

 Here is how a Google Analytics tracking code (GATC) looks like:GATC

Here is how an e-commerce tracking code looks like:

ecommerce tracking code

GATC sends page view data to Google Analytics server (via invisible _utm.gif file). Whereas e-commerce tracking code sends the ecommerce data to Google Analytics server (via invisible _utm.gif file)

Q9. Where do I add the e-commerce tracking code on a web page?

You add the e-commerce tracking code immediately after the following line in the Google Analytics tracking code:

_gaq.push([‘_trackPageView’]);

Q10. Do I need to add any special e-commerce tracking code for secure web pages (https://)?

No if you are using ga.js tracking code.

Note: the standards GATC can automatically detect when the ‘https’ protocol is being used.

Q11. Can Google Analytics track data from a shopping cart on other domain or sub-domain?

Yes. For more details refer to the post How cross domain tracking works in Google Analytics.

Q12. Where I can get more details about the various e-commerce tracking code issues?

Check out this help article.

Q13. How my e-commerce platform inserts e-commerce data into Google Analytics e-commerce tracking code?

To insert e-commerce data you need to add a server side script (like PHP) to your shopping cart receipt page.

This script should automatically retrieve ecommerce data from your shopping cart software and populate the fields of _addTrans() and _addItem() methods with it.

For example, here is what your actual ecommerce tracking code may look like if you use PHP script:

<?php

If($_SERVER[SCRIPT_NAME]==/thank-you.php”) {

?>

_gaq.push([‘_addTrans’,

‘<? = $orders[‘order_id’]?>’,

‘<? = $orders[‘store_name’]?>’,

‘<? = $orders[‘total’]?>’,

‘<? = $orders[‘tax’]?>’,

‘<? = $orders[‘shipping’]?>’,

‘<? = $orders[‘city’]?>’,

‘<? = $orders[‘region’]?>’,

‘<? = $orders[‘country’]?>’,

]);

<?php

for ($i=0;$n=sizeof($products_array);$i<$n;$i++) {

?>

_gaq.push([‘_addItem’,

‘<? = $orders[‘order_id’] ?>,

‘<? =$products_array[$i][‘sku’] ?>’,

‘<? =$products_array[$i][‘name’] ?>’,

‘<? =$products_array[$i][‘category’] ?>’,

‘<? =$products_array[$i][‘price’] ?>’,

‘<? =$products_array[$i][‘quantity’] ?>’,

]);

Note: Don’t use this e-commerce tracking code on your website. It is just an example and is not even a complete code.

Whenever your server processes a transaction, your server side code populates the fields of _addTrans() method with the transaction data retrieved from your shopping cart software.

For each unique product (i.e. product SKU) in your visitor’s transaction, your server side code populates the fields of _addItem() method with the product data retrieved from your shopping cart software.

 

 

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:

 

Join over 4000 subscribers!
Receive an update straight to your inbox every time I publish a new article.

 

About the Author:



My business thrives on referrals, so I really appreciate recommendations to people who would benefit from my help. Please feel free to endorse/forward my LinkedIn Profile to your clients, colleagues, friends and others you feel would benefit from SEO, PPC or Web Analytics.

 

 

  • https://www.thesslstore.com Kalpesh Patel

    This is really awesome…I badly needed this. It very much clear my mind about my queries regarding Google Analytics Thanks a Lot Himanshu.

  • http://www.kewl.in sanjeev

    Thanks for this detailed information on setting up conversion tracking in ecommerce. it’s more helpfull. I believe I can update my site with conversion tracking without any prb.

  • http://www.stream20.com Russell McAthy

    Very Nice post – always good to educate people on what each field is and how its calculated.

    I think its important to note than when you combine the Goal Funnels and Goal conversion rate it wont always match the e-commerce conversion rate depending on the way the e-comm funnel works on each site.

    Again thanks for an awesome post!

    • http://www.seotakeaways.com/ Himanshu

      Hi Russell! Thank you for your comment. Goal conversion rate and e-commerce conversion rate are fundamentally different metrics.

      • http://justeat.in Byomkesh Kumar

        Hi Himanshu, really helpful and detailed post. Has helped me a lot in getting the ecommerce fundamentals clear.
        Are you planning to post similar articles on goals, funnels and conversion, conversion tracking?

        • http://www.seotakeaways.com/ Himanshu

          May be :)

  • zubair

    Hey Himanshu ……thanks a lot …..believe it or not I went through a hell lot of sites just to understand how the tracking code dynamically captures the transaction values from the payment gateway. And just by the end of the day I saw ur linkedin update.

    Cheers!!!!

    • http://www.seotakeaways.com/ Himanshu

      Thanks Zubair. Glad you find the post useful.

  • Dan Richardson

    Another brilliant post from Himanshu. Fantastic stuff.
    Would love to see more on how to insert the PHP code to receipt page, without getting too deep into programming, as without this part (unless your ecomm s/w does it for you), you can’t track it. Not enough made of this imo.
    Bookmarked! Dan

    • http://www.seotakeaways.com/ Himanshu

      Thanks Dan. Unfortunately if i go any deep into PHP coding for e-commerce tracking then i first need to explain all the PHP programming concepts from the very beginning otherwise it won’t make sense for most of the non web developers readers. I would suggest you to take the help of a web developer for this task.

      • Dan Richardson

        Yes…what i meant was lots of guides/howtos make this sound easy, whereas dynamically pulling/writing php/javascript/whatever (i’m not a programmer in case you hadn’t guessed…) isn’t.
        (Wasn’t expecting you to tell us how to write the php Himanshu) :)
        Dan

  • Yari Montalbetti

    Thanks for your great post!

    • http://www.seotakeaways.com/ Himanshu

      Thanks Yari. Glad you find the post useful.

  • https://www.thesslstore.com Kalpesh Patel

    Himanshu… I have one question.
    We have multiple products in our website, All products detail page go to single checkout and thankyou page. My question is how can I create perfect funnel for each product wise. Currently I have setup product wise funnel but all go to single checkout and single thanksyou so in funnel for product 1 it shows 50 visitor land on this page 200 have gone to checkout and 120 have gone to thankyou.
    50 – > 200 -> 120 and that is wrong.

    • http://www.seotakeaways.com/ Himanshu

      You are setting up and interpreting the funnel visualization reports in a wrong way. You don’t need to set up product wise funnels. If you really want to look at the navigation path then check the ‘navigational summary report’ under Site content > All pages report.

  • Nimue

    perfect post. Thank you!

  • Nimue

    perfect post. Thank you!

    • seohimanshu

      Glad you like it.

  • yulia

    Hi! My code works. However, please help me to avoid the Google Analytic eCommerce double or triple-counting the revenue in my report. Do you think that the reason is because Customer and Vendor have access to the receipt page? How would you explain that this sometimes happens as well as when I refresh my Google Analytic Report?

    • seohimanshu

      If people can access your receipt page without making a purchase on the website then you need to talk to your web developer and request him to display the page only when someone make a purchase on the website. Send a copy of the receipt to your customers and vendors via email. Don’t let them access your receipt pages directly via a bookmark or a link.

  • Eric Erlebacher

    How can the total be less than the unit price?

    • seohimanshu

      where?

      • Eric Erlebacher

        In your examples, the product price is 76.65, but the total is 28.8.

        • seohimanshu

          common man. It is made up data and not even complete.

          • Eric Erlebacher

            Ok, but that’s my question here. I have a case where a unit price is normally $80, but we are running a sale for 50% off. The Total was listed as $40, but the Unit Price was $80. As a result, product revenue was over-reported by 100%. I want to tell the dev that the Total should never be less than the Unit Price, but I need to be sure first.

            • seohimanshu

              If you are running a sale for 50% off then the product revenue is going to be $40. In fact your unit price should also be $40.

  • raju krishna

    Can i use GA to manually frame a http ecommerce post with protocol fields. If i run in browser will it work. I can see data in realtime but not updated in reports later. My query looks Like

    http://www.google-analytics.com/collect?payload_data&z=123456&tid=UA-33585811-1&cid=5555&t=pageview&dp=billo&v=1&ta=trivium&tr=50.00&ti=OD564&ts=3.50&tt=11.20&ip=3.50&iq=4&in=Shoe&ic=x1&in=recorder&ec=finished&cs=tradus&cm=web&cn=automotosaled

    • seohimanshu

      I can’t see your query. The URL you have posted doesn’t work for me.

      • Shuja

        Thanks for such a helpful post.
        I have follow the same procedure you have described in this post, but there is no record shown in google analytics for eCommerce activities while simple tracking are shown, first i have used the analytics.js library due to which the following error was thrown on thank you page.
        ” Uncaught ReferenceError: _gaq is not defined ”
        But as i have changed the library from analytics.js to ga.js then there was no error thrown in console of my browser, but still no data about eCommerce are shown in google analyitcs while simple tracking shown updated records for my website.

        Himanshu please help me how i fix this issue i am a php developer.

        Thanks.

  • Jo Fabigal

    I have implemented e-commerce tracking and i have set up a URL goal for my purchase journey, however the total number of transactions and completed goals are different – can anyone explain why?

    Just to clarify only 1 item can be purchased at a time. The data I am seeing is as follows:

    Unique purchases = 13

    Quantity = 13

    Transactions = 16

    Goal purchase funnel completions = 12 (visitors finished)

    • seohimanshu

      Hi! Goals and ecommerce transactions are tracked differently in Google Analytics. Only one goal conversion is recorded per visitor session. For example if one of your goal is a file download and a visitor download 5 files in one web sessions then Google Analytics will record only one goal conversion. Similarly if one of your goal is a completed ecommerce transaction and a visitor carries out 3 transactions in one web session then Google analytics will record only one goal conversion. However Google Analytics will record three e-commerce transactions because transactions are tracked and recorded differently. So it is likely that you will see higher number of transactions than the number of goal conversions.

  • Shubh

    I want to remove my test orders from my ecommerce , test orders are made in mirror site . i want my standard reporting to be filtered and test orders are not visible in ecommerce transaction.. what i have to do.?

    • seohimanshu

      You can’t remove the data from reports once it is sent to the GA server. You can create a new profile with a different tracking code (different from the one on mirror site). In this way the test orders made on the mirror site won’t be recorded in your profile. If you don’t want to create a new profile than you can keep a note of the test orders you made and discount them from your final reporting. The other thing you can do is make changes to the e-commerce tracking code so that it labels the test orders as test orders in your report. Always use a different tracking code for your test/mirror site to avoid corrupting your original data.

  • nagarajan

    My code is perfect(meaning I used debugger and made sure the tracktrans, additem … are executes). But I could not see the values physically in the browser through firebug. Can we access the results only in GA.
    Thanks for the help

    • seohimanshu

      you can access the results only in GA

  • Qualli

    Unique Purchase: ” filter out the 1st product ” Why do i have to filter out the first product and how do i do that?

    • seohimanshu

      Sorry but your question is missing the context. Can you please elaborate your question.

      • Qualli

        Yeah.

        Here you write about unique purchases: ” If you look at the total unique purchases of the first product (which is 214) you may assume that 214 product items were sold in one transaction. But this is not the case. In order to truly find out how many product items were sold in one transaction you need to add ‘transaction’ as a ‘secondary dimension in the table above and then filter out the 1st product (using advanced filter on the reporting interface):”

        I dont understand why i have to filter out the first product and how i do that (what filter do i use?). I just don’t understand your context either. No offense but that’s what i want to understand ;)

        • Qualli

          And another question: I use ecommerce tracking for clickout generation to shopping sites. I have many products on the website. and i want to track every different clickout as its own conversion (transaction?). But if someone clicks on the same product two times (or more) it only should count as one clickout. Example: User clicks on Product A 2 times, then he clicks on Product B 1 time. That should be 2 conversions. Which metric do i use to find out how many different conversion a person did without the duplicated clicks on one product? Do you understand what i mean?

        • seohimanshu

          If you don’t filter out a product (whose unique purchases you want to see) then you will see unique purchases of a product item scattered throughout the report. I used the advanced filter available on the reporting interface.

  • vimal kumar

    Awesome Post.

  • mohitdxb

    Great post Himanshu! Very well described easy to read post.

  • Joyal George

    let me know all Parameters in _trackTrans() function is required?

    • seohimanshu

      we don’t pass any parameter in _trackTrans() method

  • Adrian Bereziuk

    Hi Himanshu

    Excellent and very relevant post thank you. Would you be kind enough to give me your opinion on the following question please?

    On my e-commerce site, I’m keen to show and report a more accurate conversion figure using GA and I want to filter out traffic from my conversions from visitors who have come on looking only for our store information so – would I be correct in using my ‘goal 2 conversion rate’ metric and then filtering out search traffic showing words relating to store locations?

    I’ve tried it and there is a really significant difference (far more that I’d have thought – around 7.5k%) between the two conversion rate figures after I filter this specific visitor traffic out. I’m obviously delighted about this but as there is such a difference, before I go and report on this, I’d like to have confirmation that I’m doing the right thing.

    Appreciate your comments.

    Thanks

    Adrian

    • seohimanshu

      If you are absolutely sure that the visitors looking for store information are not converting. Generally such visitors convert sooner or later or may be offline. If i were you I won’t filter out such visitors.

    • Adrian Bereziuk

      Hi Himanshu

      Many thanks for the reply.

      Because of the locations of the stores, I know there is a propensity for visitor checks to be made on locations, opening times etc and I need to take these into account which is why I have only specified visitors with store locations inside search terms. Some will of course convert online over time but as store and web business is treated as separate, I need a metric on which I can report on both over time.

      All the best

      Adrian

      • seohimanshu

        In order to track offline conversions, consider issuing a coupon on your website (with some special offer) and tracking number which can be redeemed offline at the store counter. Place this coupon on the store locations page. Once the coupon is redeemed offline you can track the visitors who came to the store via your website.

        You need to call the store manager to get this data once a month. In this way you can determine visitors who are looking for store locations on your website but making a purchase offline at the store. Calculate conversion rate of such visitors and report on it separately. Now remove these visitors from your online conversion rate calculations before you report on it.

  • hans

    Hello Himanshu, it is an excellent post regarding the Google Analytics and the code . However , I was just wandering as how do I imply this code to the tracking code. As through the codes.google.com , I have figure out to track your e-commerce transaction, you need to put these three methods , so should I paste this code in my main website coding snippets first or how do alter the tracking code to put those three methods over there. Because when I go to the tracking code it does not allow me to alter anything .

    Thank you in anticipation , Your help would be greatly appreciated.

    • seohimanshu

      Hi Hans! You need to take help of your web developer to add e-commerce tracking code to your order confirmation page. The actual e-commerce tracking code contains script specific variables.

  • Narendra

    Hi,
    This is perfect post for web analytics. I am following the same way, but still the revenue is showing/tracking as “zero”. Except revenue everything else is tracking fine. Can you help me in this.

    • seohimanshu

      Check your e-commerce tracking code and make sure that:

      1. _addTrans() method is passing the ‘total revenue’ value to the Google Analytics server.

      2. _addItem() method is passing the ‘product price’ value to the Google Analytics server.

      Take help of your web developer here who manage the shopping cart of your website.

  • http://www.facebook.com/mohitsareen Mohit Sareen

    Hi
    I have implemented e-commerce tracking on my website. However, it only captures about 50% of the transactions in the e-commerce section. At the same time it is tracking all the goal completions correctly and accurately.

    What could be the possible reason for that.

    • seohimanshu

      How you are so sure that it is tracking only 50% of the transactions?

  • Stephen Brown

    Himanshu, what are the cons of

    Track shipping as an item:
    _addItem(transactionId, sku, Shipping Type/2 day/Priority, Shipping, price, 1)

    Or as a parameter in _addTrans()?

    The benefit of knowing which type of shipping was used seems large, but it will increase the order size artificially, although every order will include one shipping item.

    Thanks for the detailed guide to the ecommerce tracking.

  • flo

    excellent. thank you.

  • kalpanamurthy

    Thank you for the Post. Great Content. I am about to implement this on a client site. Hoping your instructions will come in very handy!!!

  • JK

    can I have multiple _addTrans() and_addItem() on the same order confirmation page. we have a scenario where a admin (end user to the website) can approve multiple orders ( pending orders: orders placed by low rights users under the same account ) at same time and that will load a confirmation page saying that order 1 , order 2, order 3 are placed.

  • http://www.goatseo.com/ simone righini

    nice post! is there an updated version with the new features that come with analytics.js universal tracker?

    • seohimanshu

      not yet

  • Arshad Shaikh

    Do you know how to see exact url of my top performing products in GA ecommerce, am struggling to find ulr of mine top 10 products

    • seohimanshu

      Go to Product performance report (under Conversions > ECommerce) in your GA account. There you can sort the report by quantity or revenue to find your top performing products.

      • Arshad

        yes i can see it but how to know exact url ?

        • Arshad Shaikh

          When i click on product performance i can see the top 10 products have used secondary dimensions but still not able to figure this out how i can see the product url for each products

          • Arshad Shaikh

            hi himanshu, did you found any solution?

            • seohimanshu

              you can’t see the product URL through the product performance report. You can either search for the product URL manually by searching for the product name or you can scrape all the product pages through tools like screaming frog seo spider along with their title tags. Good question.

              • Arshad Shaikh

                Ok, am thinking to hack it using custom filter, let see how it goes will update you if i succeed :)

  • Carl

    Thank you and by the way ou can find more about What’s Google Commerce: http://www.gorkemunel.com/en/google-product-listing-ads-nedir/

  • Daniel

    Would be great to see this information but for Universal Analytics.

    I’m struggling in particular with what code to upload (I have seen plenty examples of how the code may look when it comes back – after a transaction – but I would like to know what the fields in the code are supposed to look like before the code is implemented).

  • Juhi

    Hello,
    Nice explanation.
    But let me know one thing, I m using transaction revenue tracking with authorized.net.
    is it work while test mode is on in authorized.net.
    thanks in advance..

  • Spencer

    GREAT post!

    Couple questions, what is going on if I’m seeing more goal completions than transactions… Not a large difference, but a difference… Could someone be visiting goal page twice?

    Also, how quickly do Ecommerce Transactions show up in Analytics? Is there any major lag where an order placed on one day will show up the next?

    • seohimanshu

      A goal conversion is counted only one once per unique visit. Google analytics reports update every around 2 to 4 hours with the exception of real time reports.

      • LulzCat

        If a visitor bookmarks a page (the order confirmation page) and uses their bookmark in a new visit, would GA count that as two goal conversions, even though it’s the same visitor – because it’s in 2 separate visits?

  • Allison Christiansen

    Only some of my orders are showing up on google e-commerce (right now only 1). I know this because I have access to a list of orders through an admin page on my website and there are more orders than google-ecommerce is showing (orders that were placed after the one that is showing up in google). What could some of the reasons be?

    • seotakeaways

      There is a problem with your ecommerce tracking code

  • Victor

    This is an awesome post. Thank you for the share. Bookmarked :)

    • seotakeaways

      Glad you like it.

  • http://www.sharelocalbusiness.com/ Mandeep Hooda

    Great as Always.. Now i am doing better and better with Your Blog Sir, Thanks

    • seotakeaways

      Thank you for the kind words.

  • BiHola VaNrajsiNh

    Awsm man. …Should we use the google tag manager…???

    • seotakeaways

      yes.

  • http://bloggersideas.com/ Jitendra Vaswani

    This is the one of the best guide … Thanks Himanshu … Master in GA :)

    • seotakeaways

      Glad you like it.

  • Medicin

    hi sir, very informative blog..subscribed :) I am facing a problem implementing tracking code in GA, Can u help me with it..i am new to this.

  • Rahul Singh

    Which of the following should not collect with the Google Analytic eCommerce JavaScript?(multiple answers)
    1:Billing City
    2:Purchase Amount
    3:Credit Card number
    4:Product SKU(s)
    5:Tax Amount

    • optimizesmart

      Credit card number

  • Michael

    Hey, thanks for the article. I’ve read in a lot of places (including google ecommerce tracking docs) that you should run tracking on the confirmation page AFTER the user has seen the receipt and continued back to your site. Firstly, there’s a chance the user won’t continue back to your site. Secondly, if there’s a chance to run ecommerce tracking on the receipt page, why not do it then on a page that will absolutely always be viewed?

    You’re advocating to do ecommerce tracking on the receipt, which sounds normal, so I agree with you. I’m just wondering if there’s a reason documentation everywhere suggests otherwise.

    • seotakeaways

      Mi Michael! Confirmation and receipt are same pages.

  • TC

    Great blog! One of the best for Google Analytics.
    Is it possible for unique purchases to be greater than transactions? Thanks in advance! – TC

    • optimizesmart

      no.

  • optimizesmart

    yes.

  • Nons

    Is there any way you can track shopping cart abandoners using GA. By that I mean users who do not purchase an item, but rather put items in the shoppinv cart?

  • http://www.collectorsheritage.com/ Kalu Charan Parida

    Hello Himanshu,
    I have a problem in tracking ecommerce values. In my website I have some products which are having more than one price like price1, price2, price3… with toggle button keeping currency same also I have products which are having single price. So problem is product which are having giving exact figures but product having multiple prices not giving correct figures. Please help me how to resolve this issue.