This article is an overview of setting up Enhanced Ecommerce tracking for the Google Universal Analytics tag in Tealium iQ Tag Management.

Part of the series: Google Universal Analytics Guide for iQ Tag Management

In this article:

Table of Contents Placeholder

Overview

Enhanced Ecommerce is an advanced plugin for ecommerce tracking using Google Universal Analytics to track user interactions with products on your website, including: product impressions, product clicks, viewing product details, adding a product to a shopping cart, initiating the checkout process, transactions, and refunds.

How It Works

Enhanced Ecommerce tracking works with a combination of the E-Commerce extension and data mapping in the Google Universal Analytics tag. The E-Commerce extension handles the most common ecommerce data, while the more advanced data is sent using data mappings in the tag configuration. Enhanced Ecommerce actions are also mapped in the tag as events.

Enhanced Ecommerce Data and Actions

The E-Commerce Extension settings cover many of the new Enhanced E-Commerce features. However, if your Universal Data Object (UDO) does not accommodate the data required for Enhanced E-Commerce, you will have to add variables to your website's data layer.

Here is a recommended list of data layer variables to add, along with their matching variable in Enhanced Ecommerce.

If a variable is marked as "n/a" in the E-Commerce Extension column, it must be added to the tag as a data mapping.

Impression Data

When impression data is mapped and populated in the UDO it is passed to Google Analytics using the ec:addImpression command.

Data Layer Variable Google Key E-Commerce
Extension
product_impression_id id n/a
product_impression_name name n/a
product_impression_list list n/a 
product_impression_brand brand n/a 
product_impression_category category n/a 
product_impression_variant variant n/a 
product_impression_position position n/a 
product_impression_price price n/a 

Product Data

The product variables are used in any event that expects product data. The product data required by Enhanced Ecommerce is mapped automatically via the E-Commerce Extension (see table below). Product variables are passed to Google Analytics using the ec:addProduct command.

Data Layer Variable Google Key E-Commerce
Extension
product_id id _cprod
product_name name _cprodname
product_brand brand _cbrand
product_category category _ccat
product_variant variant n/a
product_price price _cprice 
product_quantity quantity _cquan
product_promo_code coupon _cpdisc
product_position position n/a

Promotion Data

When promotion data is mapped and populated in the UDOit is passed to Google Analytics using the ec:addPromo command.

Data Layer Variable Google Key E-Commerce
Extension
promotion_id id n/a
promotion_name name n/a
promotion_creative creative n/a
promotion_position position n/a

Action Data

The action variables are populated in any event that expect order data. The order data required by Enhanced Ecommerce is automatically mapped via the E-Commerce Extension (see table below). Action variables are passed to Google Analytics using the ec:setAction command.

Data Layer Variable Google Key E-Commerce
Extension
order_id id _corder
order_store affiliation _cstore
order_grand_total revenue _ctotal
order_tax_amount tax _ctax
order_shipping_amount shipping _cship
order_promo_code coupon _cpromo
checkout_step step n/a 
shipping_method,
shipping_carrier,
payment_method,
etc.
(various checkout options) 
option n/a 

Data Mapping for Actions

Enhanced Ecommerce actions are triggered using data mappings. A data mapping for an event matches the values of the event variable to the corresponding Enhanced Ecommerce action. These mappings results in triggering the ec:setAction command in Google Analytics.

Typical event variables in your data layer would be: tealium_event, page_type, or event_name.

Example of event mappings:

gua-enh-ecomm-event-mapping2.png

The following are suggested Tealium events that map onto the expected Enhanced Ecommerce actions:

Tealium Event/Page Type Google Action
(enh_action)
product_click click
product_view detail
cart_add add
cart_remove remove
checkout checkout
checkout_option checkout_option
purchase purchase
refund  refund
promo_click promo_click

Examples

To trigger Enhanced E-Commerce actions map your event variable to an event in the data mappings.gua-enh-ecomm-event-mapping.png

Product Impression

You can send the following data with a product impression action:

  • List of IDs (required)
  • List of Names
  • List of Brands
  • List of Categories
  • List of Variants
  • Product List Names

This event occurs on page load using utag_data or using utag.view() and triggers the ec:addImpression command in Google Analytics for each item in the arrays.

// EXAMPLE CODE: Product Detail Page View
var utag_data = {
"product_impression_id" : ['P12345', 'P67890'],
"product_impression_name" : ['DV T-Shirt', 'DV Water Bottle'],
"product_impression_brand" : ['Tealium', 'Tealium'],
"product_impression_variant" : ['black', 'blue'],
"product_impression_category" : ['Shirts', 'Home & Office'],
"product_impression_list" : ['Search Results', 'Search Results'],
"product_impression_position" : [1, 2]
};

Product Click

Send the following data with a product click action:

  • List of IDs (required)
  • List of Names
  • List of Brands
  • List of Categories
  • List of Variants
  • Product Position

This event is tracked using utag.link() and triggers the ec:addProduct and ec:setAction (click) command in Google Analytics.

// EXAMPLE CODE: Product Click
utag.link({
  "tealium_event"    : "product_click",
  "product_id"       : ['P12345'],
  "product_name"     : ['DV T-Shirt'],
  "product_brand"    : ['Tealium'],
  "product_variant"  : ['black'],
  "product_category" : ['Shirts'],
  "product_position" : [1]
});

Product View/Detail

You can send the following data with a product detail action:

  • List of IDs (required)
  • List of Names
  • List of Brands
  • List of Categories
  • List of Variants

This event is tracked on page load using utag_data or using utag.view() and triggers the ec:addProduct and ec:setAction (detail) command in Google Analytics.

// EXAMPLE CODE: Product Detail Page View
var utag_data = {
  "tealium_event"    : "product_view",
"product_id" : ['P12345'], "product_name" : ['DV T-Shirt'], "product_brand" : ['Tealium'], "product_variant" : ['black'], "product_category" : ['Shirts'] };

Cart Add

You can send the following data with the cart add action:

  • List of IDs
  • List of Names
  • List of Brands
  • List of Categories
  • List of Quantities
  • List of Prices
  • List of Discounts
  • List of Variants
  • Product Position

This event is tracked using  utag.link() and triggers the ec:addProduct and ec:setAction (add) command in Google Analytics.

// EXAMPLE CODE: Product Add
utag.link({
  "tealium_event"    : 'cart_add', 
  "product_id"       : ['P12345'],
"product_name" : ['DV T-Shirt'],
"product_brand" : ['Tealium'],
"product_variant" : ['black'],
"product_category" : ['Shirts'],
"product_price" : ['23.49'],
"product_quantity" : [1] });

Cart Remove

You can send the following data with the cart remove action:

  • List of IDs
  • List of Names
  • List of Brands
  • List of Categories
  • List of Quantities
  • List of Prices
  • List of Discounts
  • List of Variants

This event is tracked using  utag.link() and triggers the ec:addProduct and ec:setAction (remove) command in Google Analytics.

// EXAMPLE CODE: Product Cart Removal
utag.link({
  "tealium_event"    : 'cart_remove',
  "product_id"       : ['P12345'],
"product_name" : ['DV T-Shirt'],
"product_brand" : ['Tealium'],
"product_variant" : ['black'],
"product_category" : ['Shirts'],
"product_price" : ['23.49'],
"product_quantity" : [1] });

Checkout

You can send the following data with the checkout action:

  • List of IDs
  • List of Names
  • List of Brands
  • List of Categories
  • List of Quantities
  • List of Prices
  • List of Discounts
  • Checkout Step
  • Checkout Option
  • List of Variants
  • Product Position

This event is tracked on page load using utag_data or using utag.view() and triggers the ec:addProduct and ec:setAction (checkout) command in Google Analytics.

// EXAMPLE CODE: Checkout
var utag_data = {
  "tealium_event"    : 'checkout',
  "product_id"       : ['P1235', 'P67890'],
  "product_name"     : ['DV T-Shirt', 'DV Water Bottle'],
  "product_brand"    : ['Tealium', 'Tealium'],
  "product_variant"  : ['black', 'blue'],
  "product_category" : ['Shirts', 'Home & Office'],
  "product_price"    : ['23.39', '11.00'], 
  "product_quantity" : [1, 2], 
  "product_position" : [1, 2],
  "checkout_step"    : "1", 
  "shipping_carrier" : 'FedEx' 
};

Checkout steps can be assigned more descriptive names using the Checkout Funnel Configuration within your Google Analytics account.

Checkout Option

The Checkout Option action lets you capture information about the state of a checkout after the initial page view, when the visitor is interacting with the site. 

You can send the following data with the checkout option action:

  • Checkout Step
  • Checkout Option

This event is tracked using  utag.link() and triggers the ec:setAction (checkout_option) command in Google Analytics.

// EXAMPLE CODE: Checkout Option
utag.link({
  "tealium_event"    : "checkout_option",
  "checkout_step"    : "2",
  "shipping_carrier" : "FedEx"
});

Purchase

You can send the following data with the purchase action:

  • Order ID
  • Revenue
  • Tax
  • Shipping
  • Promo Code
  • List of IDs
  • List of Names
  • List of Brands
  • List of Categories
  • List of Quantities
  • List of Prices
  • List of Discounts
  • List of Variants

This event is tracked on page load using utag_data or using utag.view() and triggers the and purchase command in Google Analytics.

// EXAMPLE CODE: Checkout
// The following information should be in the data object on page load
var utag_data = {
  "tealium_event"         : 'purchase',
"order_id" : 'O1234567',
"order_grand_total" : '57.44',
"order_tax_amount" : '3.65',
"order_shipping_amount" : '8.50',
"order_promo_code" : 'SALE20', "product_id" : ['P1235', 'P67890'], "product_name" : ['DV T-Shirt', 'DV Water Bottle'], "product_brand" : ['Tealium', 'Tealium'], "product_variant" : ['black', 'blue'], "product_category" : ['Shirts', 'Home & Office'], "product_price" : ['23.39', '11.00'], "product_quantity" : [1, 2] };

Promo Click

You can send the following data with a promo click action:

  • Promotion ID
  • Promotion Name
  • Promotion Creative
  • Promotion Position

This event is tracked using utag.link() and triggers the ec:addPromo and ec:setAction (promo_click) command in Google Analytics.

// EXAMPLE CODE: Promotion Click
utag.link({
  "tealium_event"      : "promo_click",
  "promotion_id"       : ['DV18-EARLY-REG'],
  "promotion_name"     : ['DV 2018 Early Registration'],
  "promotion_creative" : ['early_reg_promo1'], 
  "promotion_position" : [1]
});

Refund

In order to fire a refund action, you must have the Order ID of the transaction that is being refunded. For a partial refund, the Product IDs of any items being refunded must be present as well.

  • Order ID
  • List of Product IDs (for partial refund only)
  • List of Quantities

This event is tracked on page load using utag_data or using utag.view() and triggers the ec:addProduct and ec:setAction (refund) command in Google Analytics.

// EXAMPLE CODE: Refund
var utag_data = {
  "tealium_event"    : "refund",
  "order_id"         : 'O123456',
  "product_id"       : ['P12345'],
  "product_quantity" : [1]
}; 

Additional Resources