0405123696 petra@web-data-analytics.com

 1,428 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.

claudia impedovo

Our main purpose for generating these reports is about findings out information that will curb our strategy. The Audience Engagement Report provided us with new findings about our audience. We implemented new marketing elements based on those findings and they have increased sales.

Claudia Impedovo Brand Manager at Spendless Shoes Ecommerce Google Analytics, Google Tag Manager & Google Data Studio Integration April 23, 2020

brett leggett

Hi Petra, Hope you are well, I checked out the Google Analytics and all I can say is AWESOME. You have essentially doubled her revenue in a month and the Google Ads seem to be popping off!

Brett Leggett Brett Leggett ✪ eCommerce Growth Specialist Ecommerce Google Ads April 23, 2020

Kiley Hay Baby Carriers Australia

I have been working with Petra for over a year now after changing from a much larger digital marketing provider and I could not be more pleased with the service and results my business is achieving.

With my previous providers I felt disconnected with limited communication. Petra on the other hand provides me with knowledge and information in a language I can understand that helps me make informed decisions not just about digital marketing but also my e-commerce business as a whole.

Petra has helped me navigate seasonal drops in trade creating a strategy that helped us grow and establish a healthy position in the market. It is an absolute joy to work with someone who loves what they do. I have complete confidence in recommending Petra to anyone considering e-commerce digital marketing, she is efficient, trusted and a true professional.

Kiley Hay CEO of Baby Carriers Australia Ecommerce Google Ads April 23, 2020

Sophie Abnett

Here at 1834 Hotels we centralise the marketing for many different hotels. It can be an enormous undertaking to monitor and track the performance of each one, especially when they are all on separate webpages.

Petra helped to resolve this difficulty by creating a central hub in Google Tag Manager and Google Analytics with Cross-domain tracking and Ecommerce as well. She created many valuable analytics dashboards and reports that draw from the centralized source. Now that we have all the analytics tracking working it has improved the accuracy of our reporting and the insights have helped develop better marketing strategies.

Petra’s skills and wealth of knowledge is fantastic. I would recommend Petra without hesitation.

Sophie Abnett Digital Marketing Project Manager at 1834 Hotels Ecommerce / Hotel Google Analytics, Google Tag Manager & Google Data Studio Integration April 23, 2020

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