0405123696 petra@web-data-analytics.com

 1,710 total views,  3 views today

Product and transaction data is an important aspect of all the Google Analytics Ecommerce reports. Being able to use all the reports at your disposal is really valuable, but to do that you need to get the right data into Google Analytics. This is the trickiest part of using Google Analytics for Ecommerce, because it can be really hard to collect all that data programmatically.

Fortunately, it’s very likely that you are using an eCommerce platform that has Google Analytics Ecommerce tracking built in (or you have access to a plugin that works with that platform). If so, you can skip over this post.

This article will go into how to add your Enhanced Ecommerce tracking code manually, which is not the preferred option, but sometimes has to be done that way. It is a bit time consuming and fiddly to get right so always try to go with the easy option of a plugin or built-in tracking wherever possible. If you’re not a developer, don’t try to do this yourself.


Adding product and transaction data manually requires you to have a website developer who will write the code in the native language of your eCommerce platform. This is most likely to be PHP, but it may be different depending on the underlying platform.

To implement Google Analytics Enhanced Ecommerce, first you need to generate Javascript code containing the product and action details, formatted according to the Google Analytics Enhanced Ecommerce framework. The Javascript is written in a JSON format, which is populated with all the fields that are going to be sent through to Google Analytics. In the case of event-based tracking, the Javascript is then activated when the user does something specific in their web browser, such as click on a product. Otherwise, it triggers upon loading the page.

Important Note: While this book is about Google Analytics and doesn’t cover Google Tag Manager, I would recommend using Google Tag Manager for the Google Analytics tracking code, rather than adding Google Analytics tracking code in-line on your website. However, even using Google Tag Manager you may not be able to gain access to product or transaction data from the client browser and so you may still need to write some server-side code to push these values to the page. This article goes into writing the Enhanced Ecommerce in-line, without the use of Google Tag Manager.

Enhanced Ecommerce ends up adding quite a lot of additional code to your website because anything that you want to be tracked needs to be pre-written in Javascript upon loading the page, even if the visitor doesn’t perform the specified action.

All of the code, including the functions that are triggered from clicks and other interactions, should be in the <head> block of the website. This is to help ensure that it loads quickly.

The eCommerce tracking code also needs to be implemented so that when a visitor views a page, all of the relevant pageview eCommerce actions are sent off at once (as many of these can be stacked as you need).

Actions that are related to clicking or scrolling need to be sent to Google Analytics only when the relevant action occurs. To do this manually, without Google Tag Manager, you would use Javascript “onClick” events or a scroll listener. (Please just use Google Tag Manager)

Finally, you should set the currency in your analytics tracking code, especially when you are transacting or issuing a refund. If the currency is a different currency from the one in your Google Analytics view then it will be converted by Google Analytics to the currency in the view so hopefully you’ve already set your views up correctly. We covered setting up your views in an earlier article.

It should be noted that this may complicate your data if you send transactions and refunds through Google Analytics in different currencies. If you have the same website on different top-level domains, you may need to have it set up so that each one has a different currency set in both the website tracking code and the Google Analytics view.

With Enhanced Ecommerce tracking you can implement as much or as little tracking as you want, as long as you include the mandatory data. So depending on how your configuration is implemented, you might find there are gaps in your data (shown in your reports as 0 or (not set)) because some fields are not being captured.

OK, now we’re done with all the theory so lets get onto the different types of data that are available, so that you can implement it.

There many different data types available through this Google Analytics Enhanced Ecommerce, and these include the following.

Product Impressions

A product impression can be triggered when a visitor to your website sees a product listed on your website as part of a list of products (even if it is the only product listed). It is used by Product List reports and dimensions in Google Analytics. You can see an examples of the allowable options in the image below:

Google Analytics. Retrieved from https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce

Product Data

Product data can be added to any action that is carried out with regard to a particular product. You have seen this data already in the example of a transaction. It is used by almost every eCommerce report and dimension in Google Analytics – essentially, anything that refers to a product. You can see an example of this in the image below:

Google Analytics. Retrieved from https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce

Promotion Data

This refers to a particular promotion that someone may see on a website; for example, a specific banner advertisement. This is similar to product impressions, but applies to an internal promotion instead. Promotion Data does not include any products. It is used in the Ecommerce Overview report and the Marketing Internal Promotion report. You can see an example of this below:

Google Analytics. Retrieved from https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce

Action Data

This is used whenever it is necessary to track an action that a visitor has performed. In order for the action to be identified, an action identifier should be used. Action identifiers are shown in the next table. You have seen an example of an action already in the example of a transaction. Action data is used to populate all of the eCommerce reports included in Google Analytics. In particular, the Product Detail View, Add to Cart, Checkout and Purchase actions are used repeatedly throughout the eCommerce reports, and should be implemented in all eCommerce configurations..

Google Analytics. Retrieved from https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce

Product and Promotion Actions

These specific action types enable Google Analytics to correctly identify an action, in order to then add the data to the appropriate Ecommerce Analytics report.

Google Analytics. Retrieved from https://developers.google.com/analytics/devguides/collection/analyticsjs/ecommerce

You will now have discovered that there are a wealth of eCommerce tracking options included in Google Analytics Enhanced Ecommerce, and I hope this article has been helpful in outlining these. The options can be a little overwhelming however, so if you are feeling uncertain of what to implement, please reach out for customised advice.

Adam Lochery Ecommerce Google Ads

We’ve been working with Petra and her team at the Quantified Web on our Google Ad Campaigns for 12 months now and in that time we’ve had to increase our targets on Return on Ad Spend due to the excellent performance of the campaigns she’s helped implement.

The data we receive is supremely rich and helps give valuable insight into key demographics, areas of interest, types of content most likely to resonate and most importantly, is communicated in a digestible, easy to understand format.

We thoroughly enjoy working with Petra and look forward to even more online success through our partnership

Adam Lochery Ecommerce Manager of Spacetalk [Ecommerce] Ecommerce Google Ads April 26, 2021

david clayton myomasters

Your attention to detail is beyond what I had expected. The detail of the data is incredible. The best part though was to learn the profile demographic - which is very different to whom I think I've been trying to target through social.

David Clayton Director, Myomasters Massage Health Clinic Google Ads April 23, 2020

Kiara Buccella Google Ads
The Quantified Web has managed the Mayfair Hotel’s Google Ad campaigns for almost two years now.
We have had a wonderful experience with Petra, she demonstrates great care for her clients and is proactive in providing insights and suggestions on how to optimise performance.
Petra is thorough and efficient in her communication and we would certainly recommend her to others businesses.

Kiara Buccella Marketing Executive of Mayfair Hotel Google Ads Management April 26, 2021

Amanda Matthews Ecommerce Google Ads
We have been working with Petra and her team at The Quantified Web for the past couple of years now. She has been helping us to build our online presence and sales with our supplement ecommerce business.
I struggle a lot with Google Ads and all the nitty gritty side to the adwords and algorithms, but Petra explains things in an easy to understand manner.
She and her team communicate with us well and frequently to keep us up to date on how our ads are running and what we can do to improve.
I couldn't recommend Petra and her team any more!

Amanda Matthews CEO of Body4Life [Ecommerce] Ecommerce Google Ads April 26, 2021

leesa dawson

I am so grateful to have met you, as I think your insights are the BEST I have ever come across.

Leesa Dawson CEO, The Uniform Stylist Ecommerce Google Ads April 23, 2020