Understanding Google Analytics Product Data Import

In this article, I will explain the ‘Product data import’ feature of Google Analytics.

I will do that by showing, how the ‘product data import’ feature can be used to correctly install the enhanced ecommerce tracking on a website.

This article is esp. useful for those optimizers who have either not installed enhanced ecommerce tracking yet or who have installed enhanced ecommerce tracking but they are not getting all of the enhanced ecommerce data in their reports.

You can install enhanced ecommerce tracking with and without Google Tag Manager (GTM).

I have written this article under the assumption that you are either going to install enhanced ecommerce tracking via GTM or you have already installed enhanced ecommerce tracking via GTM.

However my article is equally valid, even if you have installed enhanced ecommerce tracking without GTM or planning to install enhanced ecommerce without GTM.

Enhanced ecommerce tracking is one of the most difficult tracking to implement in Google Analytics.

Bigger the ecommerce website, more difficult implementing this tracking becomes.

The major part of enhanced ecommerce tracking set up is tagging the web pages and page elements (like ‘Add to Cart’ button) with product data. In case of Google Tag Manager, we do the tagging via data layers.

Following is the example of a data layer for sending Product Impression Data to Google Analytics:

<script>
// Product impressions are sent by pushing an impressions object
// containing one or more impressionFieldObjects.
dataLayer.push({
‘ecommerce’: {
‘currencyCode’: ‘USD’, // Local currency is optional.
‘impressions’: [
{
‘name’: ‘Deep U Neck Loose T-shirt’, // Name or ID is required.
‘id’: ‘5678698’,
‘price’: ‘36.50’,
‘brand’: ‘VB’,
‘category’: ‘New Clothing’,
‘variant’: ‘White’,
‘list’: ‘Search Results’,
‘position’: 1
},
{
‘name’: ‘Hooded Pointed-Long-Hem Cowl Top’,
‘id’: ‘8879609’,
‘price’: ‘67.65’,
‘brand’: ‘VB’,
‘category’: ‘New Clothing’,
‘variant’: ‘Black’,
‘list’: ‘Search Results’,
‘position’: 2
}]
}
});
</script>

As you can see, the data layer list the product information of two products listed on a search result page.

Get the E-Book (37 Pages)

Learn to read e-commerce reports book banner

Get the E-Book (104 Pages)

 

But what if your search result page list 10 products or 100 products?

In that case your data layer would contain product information for 10 or 100 products.

This will make your data layer extremely large and here is where the problem occurs.

Google Analytics has put a limit on the amount of data you can send in a hit.

So when you send product data for dozens or hundreds of products (listed on a search result page or category page) via data layer to Google Analytics, then the size of the total data sent in a single hit may exceed the limit imposed by GA.

In that case, there is no guarantee that all of the product data will be sent to GA.

This issue can create data discrepancies in your enhanced ecommerce reports.

Consequently you may not get all of the sales data or product data in your reports even when the data layers are all correctly installed and all GTM tags are correctly configured.

This is something which Google Analytics failed to mention in its help documentation.

But this is something which you need to consider before creating and adding data layers to various pages of your website.

If your enhanced ecommerce reports are not showing all of the product or sales data and you can’t figure out what went wrong with the implementation, then exceeding the hit size limit could be the reason.

In order to minimize / eliminate the possibility of data loss, you need to minimize the amount of product data you send in a single hit.

Product name, product price, brand, color, variant etc are examples of product data.

We send this product data with each data layer which not only increase the size of the data layer but also increase the size of the data sent in a hit.

So if we don’t add this product data in a data layer, then this will reduce the size of the data layer and less amount of product data will be sent in a hit.

We can achieve this objective by importing all of the product data via Google Analytics user interface or via the management API.

In this way we don’t need to send all of the product data with each enhanced ecommerce data layer.

We would then just need to send the product ID and any additional data (like list name and position) which was not imported.

Google Analytics will then automatically add all of the product data to the enhanced ecommerce hit at collection time by matching the product ID you sent in a hit to the corresponding product ID in the imported product data set.

So following data layer

<script>
// Product impressions are sent by pushing an impressions object
// containing one or more impressionFieldObjects.
dataLayer.push({
‘ecommerce’: {
‘currencyCode’: ‘USD’, // Local currency is optional.
‘impressions’: [
{
‘name’: ‘Deep U Neck Loose T-shirt’, // Name or ID is required.
‘id’: ‘5678698’,
‘price’: ‘36.50’,
‘brand’: ‘VB’,
‘category’: ‘New Clothing’,
‘variant’: ‘White’,
‘list’: ‘Search Results’,
‘position’: 1
},
{
‘name’: ‘Hooded Pointed-Long-Hem Cowl Top’,
‘id’: ‘8879609’,
‘price’: ‘67.65’,
‘brand’: ‘VB’,
‘category’: ‘New Clothing’,
‘variant’: ‘Black’,
‘list’: ‘Search Results’,
‘position’: 2
}]
}
});
</script>

could be trimmed down like the one below after product data import:

<script>
// Product impressions are sent by pushing an impressions object
// containing one or more impressionFieldObjects.

// The product name, price, and other product data will be added to this hit
// at collection time if the value of the id field matches a Product SKU/ID you have uploaded.

dataLayer.push({
‘ecommerce’: {
‘currencyCode’: ‘USD’, // Local currency is optional.
‘impressions’: [
{
‘id’: ‘5678698’,
‘list’: ‘Search Results’,
‘position’: 1
},
{
‘id’: ‘8879609’,
‘list’: ‘Search Results’,
‘position’: 2
}]
}
});
</script>

Even though you are now just sending product ID via data layer, your enhanced ecommerce reports would still be populated with all of the product data (product price, product brand, variant, color, size etc).

New roadmap for Enhanced Ecommerce tracking setup via GTM

Following would be the process to implement enhanced ecommerce tracking via GTM once you have made Product data import a part of your setup:

#1 Determine your tracking requirements

#2 Decide the product data you want to import

#3 Create custom dimensions (optional)

#4 Create product data set

#5 Upload Product data

#6 Create / Modify Data Layers

#7 Add data layers to predetermined web pages and pages elements.

#8 Create and configure your GTM tags.

#9 Test enhanced ecommerce tracking on the website.

#10 Remove existing ecommerce tracking code and deploy the new enhanced ecommerce tracking on your website.

Here the steps highlighted in bold (step 2 to 6) are the new steps you need to follow while implementing / modifying enhanced ecommerce tracking setup.

I am going to explain only the steps from 2 to 6 as they are new.

If you want to learn more about the other steps, then read this article: Implementing Enhanced Ecommerce Tracking via Google Tag Manager

#2 Decide the product data you want to import

The product data you want to import depends upon the product attributes available.

Following are the examples of product attributes:

  • Product name
  • Product price
  • Product brand
  • Product color
  • Product size
  • Product availability

#3 Create custom dimensions (optional)

If you have got product attributes (like product color and product size) which can’t be measured via any predefined dimension (i.e. the dimensions which are already available in GA) then you need to create new custom dimensions:custom dimension product scope

Here I have created two new custom dimensions called ‘Product Color’ and ‘Product Size’ to collect data related to product color and size.

Make sure that the custom dimensions you create to collect data for your product attributes must have scope set to ‘Product’.

If the custom dimension scope is set to hit, session or user, then it won’t be available for upload as product data.

#4 Create product data set

Follow the steps below to create product data set:

Step-1: Navigate to the Admin section of your GA view and then click on the link ‘Data Import’ under ‘Property’ column:

Step-2: Click on the ‘Create’ button:

Note: Google Analytics terms of service does not allow you to upload personally identifiable information (like name, email address, house address, IP addressees etc) via the data import feature.

Step-3: Select ‘Product Data’ as data set type:

product data set

Step-4: Click on the ‘Continue’ button.

Step-5: Enter the name of the new data set and then select the view(s )(from the drop down menu) that will make use of the data in the data set:

Step-6: Click on the ‘Continue’ button and then define your data set schema like the one below:

Step-7: Set ‘Overwrite Hit data’ setting to ‘Yes’ and then click on the ‘save’ button:

Step-8: Click on the ‘Done’ button:

Step-9: Click on the ‘Get Schema’ button:

Step-10: Click on the ‘Download Schema template’ button and then click on the ‘Done’ button:

Step-11: The schema template is in the form of a CSV file. Open this file and then add all of the product data to this file:

Here,

ga:productSku => Product ID
ga:productName => Product name
ga:productBrand => Product Brand
ga:productCategoryHierarchy => Product Category
ga:productVariant
=> Product Variant
ga:productPrice => Product price

Step-12: Upload the CSV file you created to Google Analytics. There are two methods to upload this data. You can either upload the product data manually via GA user interface or via management API.

I am going to show you how to upload the data via user interface as it easier method.

Step-13: Click on the ‘Upload file’ button  and then click on the ‘Choose File’ button to select your CSV file:

Step-14: Click on the ‘Upload’ button to upload product data to your GA property.

If the data is successful uploaded then you would see the message ‘completed’ under the ‘Status’ column:

#6 Create / Modify Data Layers

Create trimmed down versions of enhanced ecommerce data layers as mentioned above.

Instead of passing all of the product information, just pass product IDs and any additional data (like list name, position, product coupon etc) which wasn’t imported via Data import.

Other methods to reduce the size of enhanced ecommerce data layers

If you find your data layers too big even after using the product data import then there are three things you can do:

#1 Reduce the number of products you display at a time on product category pages, product sub-category pages or search result pages. This can be done by making changes to the website navigation.

#2 Push the product data of only those products into data layers which are actually viewed. One method of doing this is through scroll based impression tracking which is explained in great detail in this article.

#3 Push only that data into data layers which is really important for your analysis.

There are ‘N’ things that can be tracked. But sometimes because of shopping cart or CMS constraints or hit size limit it is not possible to track and send all of the data. In that case, we have to be very selective about the data we choose to send in a hit.

Learn about the Google Analytics Usage Trends Tool

The Google Analytics usage trend is a new tool which is used to visualise trends in your Google Analytics data and to perform trend analysis.


Take your knowledge of Web Analytics to the next level. Checkout my web analytics training course.

Take your Analytics knowledge to the next level. Checkout my Best Selling Books on Amazon

Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.

Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.

Attribution Modelling in Google Analytics and Beyond
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.

Himanshu Sharma

Certified web analyst and founder of OptimizeSmart.com

My name is Himanshu Sharma and I help businesses find and fix their Google Analytics and conversion issues. If you have any questions or comments please contact me.

  • Over eleven years' experience in SEO, PPC and web analytics
  • Google Analytics certified
  • Google AdWords certified
  • Nominated for Digital Analytics Association Award for Excellence
  • Bachelors degree in Internet Science
  • Founder of OptimizeSmart.com and EventEducation.com

I am also the author of three books:

error: Alert: Content is protected !!