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.

Get your copy of this book

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

Get Even Better Results From Your Digital Marketing

Stay up-to-date with the different ways you can measure the success of your website and digital marketing... You will get even better results!

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.

Share this article!

Get Even Better Results From Your Digital Marketing

Stay up-to-date with the different ways you can measure the success of your website and digital marketing... You will get even better results!

SleepWise Clinic

Petra was instrumental in pulling all our clinic's web analytics into one easy to read, dynamic report that's accessible to me at any time, and works with our EXACT booking system.

This has allowed me to see, at a glance, what marketing initiatives are working, need tweaking, or changing altogether, saving me both time and money. I can't recommend her or her analytic services enough.

Ian Gale SleepWise Clinic Strategy Session August 1, 2018

shares