A Comprehensive Guide to Enhanced Ecommerce Tracking in Google Analytics

If visitors to a physical store keep asking: "Where do I find headphones?", you can put headphones out in plain sight and make it front and center :). Wait, how does that translate to your online store? How do you know which pages were viewed before a purchase? Which products are most often bought, and which products are most often removed from shopping carts? How effective are internal banners at promoting sales on your website?

Enhanced Ecommerce in Google Analytics can help you answer all of the above, and lots of other questions. You’ll be able to map your customers’ journey from the very first visit to a purchase. For example, you can:

  • Uncover how many times a particular product was purchased.
  • Group your products into product lists, such as Recently Viewed Products, Related Products and New Products.
  • Use these product lists to represent merchandising blocks and see how these blocks perform.
  • Create segments based on product brand names, customer behavior, etc., and target your campaigns towards these segments.
  • Send the campaign name to Google Analytics as an additional parameter. This will enable you to see how your internal promotions are performing, and measure the impact promo campaigns and special offers have on conversion rates for certain product groups.

Below, we’ll explore how to set up Enhanced Ecommerce in Google Analytics using Google Tag Manager.

Table of contents

What to track

Before setting up Enhanced Ecommerce tracking, decide what activities you want to get data for. These include:

  1. Product views on a category page.
  2. Clicks on products.
  3. Product pageviews.
  4. Adding and removing products from carts.
  5. Viewing internal promotion materials: banners, videos, pop up windows, etc.
  6. Clicks on banners.
  7. Checkouts. The checkout process can also be broken down into steps: filling contact, delivery, payment information, etc., and tracked with a separate funnel.
  8. Purchases.
  9. Refunds.

How to set up Enhanced Ecommerce in Google Analytics

You can send data from your website to Google Analytics using JavaScript, Google Tag Manager, and the Measurement Protocol.

In our opinion, the best tool for getting Ecommerce data to Google Analytics is Google Tag Manager, It makes it easy to add and update tags and code snippets on the website without having to involve developers. Therefore, in this article we’ll be talking about this way to collect data. To find out more about what else you can do with Google Tag Manager, see our blogpost.

Broadly speaking, Enhanced Ecommerce is set up as follows:

  1. Enabling Enhanced Ecommerce reporting in Google Analytics.
  2. Placing the Google Tag Manager container code snippet into all your website pages.
  3. Adding the dataLayer A JavaScript array containing all the data that you want to pass to Google Tag Manager array above the Google Tag Manager code snippet and populating it with objects.
  4. Creating a tag in Google Tag Manager to send data from the dataLayer to Google Analytics.
  5. Adding Custom Dimensions to the dataLayer or Google Tag Manager (optional).

Let’s take a closer look at each step.

Step 1. Enable Enhanced Ecommerce

To see data about product pageviews, transactions, and other shopping activities within your sales funnel, enable Enhanced Ecommerce reporting in Google Analytics.

Navigate to the Admin panel in Google Analytics, select the View you want to use, and click Ecommerce Settings. Under Enable Ecommerce, set the status to ON. Also, set the status to ON under the next step, Enable Enhanced Ecommerce Reporting.

Enable Enhanced Ecommerce in Google Analytics

The detailed information about how to set up Google Analytics can be found in our blogpost.

Step 2. Add the Google Tag Manager container snippet to your website

To set up web tracking, you need to add the GTM container code snippet to all your website’s pages. See the Google Tag Manager Quick Start Guide for the detailed information about how to implement GTM on your website, and the code snippets you’ll need to add.

Step 3. Add dataLayer variables

You also need to add a dataLayer array above the GTM code snippet on all your website pages. This array contains the information that you want to pass to Google Tag Manager. Read the Google Tag Manager Developer Guide for more information about what dataLayer is and how to use it.

The dataLayer structure depends on what on-site activities you want to track. Below is an example of an object that can be added to the dataLayer to enable product pageview tracking:

For detailed information about how to use the dataLayer to measure other Ecommerce interactions: product impressions, clicks, purchases, checkout steps, etc., refer to the Google Tag Manager Enhanced Ecommerce guide.

Step 4. Sending data into Google Analytics

To pass the data from the dataLayer to Google Analytics, create a new Universal Analytics tag in Google Tag Manager:

Choose Universal Analytics tag type in Google Tag Manager

For more information about tag configurations in Google Tag Manager, see the Help section.

Check the "Enable overriding settings in this tag" box. In More Settings, click Ecommerce and set Enable Enhanced Ecommerce Features to True. Then, check the Use Data Layer box.

Use the Data Layer to implement Ecommerce tracking

Step 5. Add Custom Dimensions

Now let’s see what other features you can use.

Let’s say you want your reports to reflect data that can’t be provided with standard dimensions: product size, weight, color, availability in stock, etc.

There are 2 options for meeting this challenge:

  • Pass the additional parameter directly to the dataLayer and use the settings described above.
  • Use the Data Import to load this data into Google Analytics.

It’s more convenient to pass all the data with the dataLayer. However, this may result in exceeding the maximum hit size limit. We’ll discuss this in more detail below. In the meantime, let’s take a look at how you can add an additional parameter to the dataLayer to track the availability status of the item:

Why add this dimension? It helps see how many visitors landed on pages of products not available in stock by clicking on paid ads. Compare the revenue per visitor (RPV) depending on the product’s availability status on the landing page. This will allow you to see if you’re wasting your paid traffic or not: it all depends on how much revenue a visitor brings you in the end. You can also increase the RPV by recommending products from the Related Products list in Google Analytics.

Note that the key of the additional parameter above should correspond to the slot of the previously created Custom Dimension in the Google Analytics → Property → Custom Definitions → Custom Dimensions menu. For more information about how to create Custom Dimensions, see our blogpost.

Add Custom Dimensions to collect additional data

Let’s say you only sell a few products on the website, and the data for the products is updated only rarely. In this case, you can use Custom Dimensions with Google Tag Manager instead of asking developers to fill in the dataLayer. To do this, create an additional variable and specify that it should be used instead of the dataLayer data.

Create a new variable:

Configure variables in Google Tag Manager using Custom JavaScript

Add the newly created variable instead of using the dataLayer data:

Use Variables to read Ecommerce data, if needed

This tag will be fired on the specified page, and the data returned by the previously created variable will be sent to Google Analytics in the Enhanced Ecommerce format.

Also, you can change Ecommerce objects A JavaScript object that contains the action ID, and products with which the action was made that have been added to the dataLayer. This can be useful in a number of situations. For example, when the hit size exceeds the limit and some parameters must be deleted before passing the data. Or, when the order IDs differ on the website and on the payment gateway system website, and a single unified ID must be passed to ensure correct reporting.

To do this, create a separate data-level variable. Let’s call it the Ecommerce Variable:

Configure a Data Layer Variable

This variable will take the value of the dataLayer object. Then, create another variable that will access the value stored in the first variable. This will allow you to change the values you need before sending the data to Google Analytics.

Note that it’s a temporary measure. It’s necessary to make changes to the data before the data will be added to the dataLayer. Contact the developers at the earliest opportunity.

The two funnels in reports: what’s the difference and why you need them

There are two types of funnels you will see in the Ecommerce group of reports after setting up Enhanced Ecommerce. The first funnel can be seen in the Shopping Behavior Analysis report. The other one is available in the Checkout Behavior Analysis report.

The first funnel reflects how visitors interact with the website. This includes all user activities you wanted to track and specified during the configuration. This is how the funnel looks like (to avoid any confusion, let’s call it the sales funnel):

Analyze user activities with the Shopping Behavior Analysis visualization

The example above shows that there’s a narrow bottleneck. Most users (78.8%) abandon the funnel before visiting product pages. What could be the reason for this? First of all, you can check the bounce rate for the landing pages. If the bounce rate is high, check if the website is displayed correctly in different browsers and on different devices. See if there are any problems with visiting other webpages. Check the filter settings. It’s also worth checking Google Analytics Site Search reports for search queries of visitors who left the website after visiting only one page. This will help determine why the website did not meet their expectations. See the Help for more information on how to set up Google Analytics Site Search reports.

Next, you’ll need to check the paths other users take. Some of them might add products to the cart right from the product block, bypassing the product page step. You can check this in two ways:

  • Use event tracking to get data about the page type/URL.
  • Add the list value to the Ecommerce object.

Finally, make sure that nothing prevents users from visiting the product list, both from the menu and from the site search.

The funnel visualization shows the number of sessions for each step, the share of transitions, and the number of sessions in which users abandoned the funnel. Note that the funnel is open, i.e. users can enter it at any stage. You can also use the visualization to create Enhanced Ecommerce segments based on funnel entrances, steps, transitions, and abandonment.

Create Ecommerce segments based on user actions

You can use the segments in remarketing, to bring users back to the funnel. For example, you can send reminder emails to users who have registered on the website, added products to cart but haven’t bought them. For more information on creating segments, see the Google Analytics Help for Enhanced Ecommerce.

The second funnel is very similar to the first one. The difference is that, it only illustrates the steps of the checkout process: filling in contact information, choosing a payment method, transaction, etc.

Visualize steps of the checkout process in the Checkout Behavior Analysis report

In our example, there are only three steps in the checkout funnel. If you need to capture additional information about user activities on a certain step, you can use checkout options. Let’s say for example, the payment method is not yet known when a user enters the Payment step. With the checkout option, the data about the selected payment method will be sent to Google Analytics. More information about tag configurations and using the dataLayer to measure checkout activities can be found in the Google Tag Manager Web Tracking Help.

You can also give a distinct name to each step in the report. To do so, navigate to Google Analytics → Property → Ecommerce Settings.

Give a descriptive name to each step in the checkout process

How to track product returns and refunds in Google Analytics reports

Part of the orders placed on the website might not be completed. Your customers might return their purchases or simply not pick them up. What can you do, considering that you can’t change the data already sent to Google Analytics, while refunds and cancellations distort the statistics?

In such cases, you can send refund information to Google Analytics. This will not affect the revenue data received before, but you’ll be able to take account of the amount of refunds and their number in the reports.

The refund data can be sent to Google Analytics in 2 ways:

  • Automatically, using the Measurement Protocol, if your company’s developers have time to configure automatic data transfer. By the way, you can download a detailed guide on how to send missing data about orders to Google Analytics via the Measurement Protocol.
  • Manually, using the Data Import. This approach is more time consuming and has its own nuances and limitations, such as: you can only issue refunds for transactions not older than 6 months, and different upload files must be used for full and partial refund types. To learn more, read about Refund Data Import in the Google Analytics Help Center.

Limitations in collecting data in Google Analytics

Hit payload size in analytics.js must not exceed 8KB. There’s a high risk of hitting this limit while sending product data to Google Analytics, for the following reasons:

  • When too many products are sent in a single hit payload. For example, when 100 products are displayed on one catalog page, and the impression data for all the products is dispatched as one hit.
  • When too many product parameters are sent in one hit payload.
  • When the names are too long, especially if non-Latin alphabets are used in naming. In this case, the data in requests is encoded, which significantly increases the size of the request.

How to meet the limitation challenge:

  • Split the data into multiple objects and send it as different hits. The drawback of this method is that more hits will be sent to Google Analytics, which in turn can negatively affect data sampling. Moreover, it will be impossible to accurately determine the number of products sent in one hit.
  • A more preferable option: use the Data Import to upload additional product metadata, such as color, size, or other parameters, using the Product SKU key.
  • If possible, use Latin symbols to name the parameters.

Online merchandising: Product List Performance

Proper showcasing helps increase sales. For example, buyers most often pay attention to the shelves at their eye level. Therefore, if there are products you want to sell first, it’s better to place them on such shelves.

How does that translate to your online store? How do you know which "showcases" and "shelves" on the website have the most products sold? Use the Product List Performance report to measure the performance of merchandising blocks on the website. The report is available in the Conversions → Goals group of reports.

Measure the performance of your Product Lists

The report shows what blocks are viewed most often, products in what blocks are most often clicked on or added to shopping carts, what product lists have the highest conversion rates and contribute to sales.

It’s important to pay attention to how Product Attribution works, in other words, how to correctly send data with the dataLayer. This will help see correct information for each product block, and accurately attribute value from product lists which users interacted with before making a purchase.

It’s not necessary to send the list attribute (list) with every Ecommerce activity. For example, a user visits a product page A, sees a product B in the "Often bought together" list, clicks on it and makes a purchase — all the shopping activities in one session. In this case, it’s enough to specify the list attribute for the first action, i.e. the first interaction with the list. Google Analytics will then associate the list attribute to all the funnel steps in the user’s journey to buying the product B. More information about Product Attribution can be found in the Google Analytics Help.

Thanks for reading! We’ve prepared some more useful information for afterwards :) Enter your email address, and we’ll send a detailed guide to getting offline data (such as data about order fulfillment and purchases made over the phone) to Google Analytics via the Measurement Protocol.