Setting up E-Commerce Tracking on Google Analytics

Share this article...Share on Facebook
Tweet about this on Twitter
Share on LinkedIn
Email this to someone

Many people have trouble setting up E-Commerce Tracking within Google Analytics. In this post, I will run through what E-Commerce tracking is, with a step by step guide on how to integrate it with your Google Analytics, in order to get an accurate gauge of how much money your website is directly producing.

What is E-Commerce Tracking?

If your business is selling products online, reporting product purchases and purchase value are essential to understanding, benchmarking and measuring performance. Your website can understand the success of your marketing efforts by linking them with the number of purchases, subsequently tracking the return on investment (ROI).

If you can analyse your user behaviour and your marketing performance, you will be able to optimise the user experience and ultimately increase business revenue.


Image result for e-commerce

Setting up E-Commerce Tracking

  1. Within your Analytics account, select Admin, and choose the view you want to use to measure transactions.
  2. Under the ‘View Column’ column, select E-Commerce Settings.
  3. Click the Enable E-Commerce toggle ON.
  4. Click Next step.
  5. Click Submit.
  6. Add Conversion code onto the conversion complete page.

Additional code to go into the ‘Thank You’ Page

For many platforms, you will also need to add additional code to the Transaction completion page, in order for Google Analytics to pick up the required information from the page.

The sample code is displayed below, although the parts in red will need to be changed to dynamic code, which will depend on the structure and setup of your website:

‘transactionId’: ‘98765‘, // Transaction ID – this is normally generated by your system.
‘transactionAffiliation’: ‘Sugarbush Mt.‘, // Affiliation or store name
‘transactionTotal’: ‘89.00‘, // Grand Total
‘transactionTax’: ‘5.99‘ , // Tax.
‘transactionShipping’:’0′, // Shipping cost
‘transactionProducts’: [
‘sku’: ‘LTAFD‘, // SKU/code.
‘name’: ‘One Day Adult Lift Ticket‘, // Product name.
‘category’: ‘Lift Tickets‘, // Category or variation.
‘price’: ‘89.00‘, // Unit price.
‘quantity’: ‘1

The above code needs to be placed just above the closing body tag for best results.

Common Issues with E-Commerce Tracking

If you have already set up E-Commerce Tracking and have concerns that it is not picking up all of the data required, you should check the following common errors:

  • Is the E-Commerce tracking code firing multiple times? It’s not uncommon for the user to refresh the confirmation page or to save it as a bookmark after they have made a transaction. This can present a challenge as the same transaction data is being sent to Google Analytics every time the confirmation page is loaded, meaning that duplicate results may appear in the reports. A way to resolve this is to set a flag once the E-Commerce tracking has been sent.  A ‘flag’ typically involves adding code to incorporate an extra column to mark a user as ‘tracked’ in the e-commerce transaction history database (more info here). Once the flag has been set, if the same confirmation page is hit again, if that user info comes up as ‘tracked’ in the database the E-Commerce tracking isn’t fired and instead it’s just recorded as a page view.
  • Amounts over 1,000 can confuse JavaScript If your E-Commerce site regularly receives transactions with the cost or quantity of an order over 1,000 (whether that’s pounds, dollars, pairs of jeans, sweets, anything), this common problem is something you should be aware of. When writing numbers to a web page, some coding languages will automatically add a comma to support localised number formats if the value is over 1,000. For example, 1684 would be written as 1,684. This has been known to cause problems when sending the data to GA, as JavaScript will have issues parsing a number which contains a comma, unless it is specified as a string. To avoid this issue, you need to ensure that numeric values do not contain a comma when the data is sent to Google Analytics.
  • Missing Tracking Code On Pages If the JavaScript code snippet for Google Analytics is missing on a single page, then the page can’t be tracked. While this is more common on sites that have individually-coded pages or run across multiple platforms, many sites that run on a single CMS (Content Management System) may still have this problem if they use different templates for different sections of a site — any of which may be missing the code. You can use a program such as Screaming Frog or the Google Tag Manager Browser Extension, which can quickly identify any pages missing your analytics code.
  • Google Analytics code in the wrong place on the page According to Google Analytics, its script should be placed after the opening <body> tag. Many things can go wrong with the script, depending on its location. One of the worst cases would occur when a user leaves a page before the code can fire, preventing tracking. The other end of this spectrum is that you could be sending the tracking code before the e-commerce data has loaded onto the page, causing the e-commerce data to be blank or report an error.

If you have any questions about E-Commerce Tracking or Google Analytics in general, please drop me a line at or give us a call at 02890683790.

Share this article...Share on Facebook
Tweet about this on Twitter
Share on LinkedIn
Email this to someone


No comments yet.

Leave a Reply