Notification

G Suite is now Google Workspace: everything your business needs to get work done.

[UA] Universal Analytics ecommerce [Legacy]

Use Tag Manager to implement Google Analytics ecommerce tags.
You are viewing a legacy article about Universal Analytics. Learn more about Google Analytics 4 replacing Universal Analytics.
Note: This article refers to Universal Analytics ecommerce. Google Analytics 4 is the future of Google Analytics. It is recommended to implement and send GA4 ecommerce events to ensure you can take advantage of all Google Analytics features in the long-term. To learn how to implement ecommerce measurement with Google Analytics 4, read the developer documentation. To learn how to migrate your ecommerce implementation from UA to GA4, see the new GA4 ecommerce migration guide.

There are two main types of Universal Analytics ecommerce implementation methods: Standard ecommerce and enhanced ecommerce.

Standard ecommerce reports allow you to measure transactions and analyze purchase activity on your site or app. You can see product and transaction information, average order value, ecommerce conversion rate, time to purchase, and other data.

Enhanced ecommerce adds additional functionality to standard ecommerce reports. Enhanced ecommerce shows when customers added items to their shopping carts, when they started the checkout process, and when they completed a purchase. You can also use enhanced ecommerce to identify segments of customers who fall out of the shopping funnel.

These instructions describe how to use Google Tag Manager to implement Universal Analytics ecommerce tags.

Standard Ecommerce

To set up a standard Universal Analytics ecommerce tag:

  1. Login to your Google Analytics Account and enable ecommerce for the view you want.
  2. Create a Universal Analytics tag and set the Track Type to Transaction.
  3. Configure your tag with the required fields.
  4. Add the dataLayer() object to the transaction page to collect and pass the required variables. Make sure the dataLayer() variables are populated in code before the tag fires.
  5. Create a trigger to fire the tag on the transaction confirmation page.

All the transaction information should be passed via the data layer, with the variable names shown below:

Transaction Data

Variable Name Description Type
transactionId (Required) Unique transaction identifier string
transactionAffiliation (Optional) Partner or store string
transactionTotal (Required) Total value of the transaction numeric
transactionShipping (Optional) Shipping charge for the transaction numeric
transactionTax (Optional) Tax amount for the transaction numeric
transactionProducts (Optional) List of items purchased in the transaction array of product objects

Product Data

Variable Name Description Type
name (Required) Product name string
sku (Required) Product SKU string
category (Optional) Product category string
price (Required) Unit price numeric
quantity (Required) Number of items numeric

Place this code above the Tag Manager container snippet so that the data layer is ready when Tag Manager fires the Google Analytics tag.

If for some reason you can’t place the ecommerce data above the Tag Manager container snippet, you can try one of these solutions:

  • Have the tag fire based on a custom event farther down the page (e.g. combine the data and the event push as described in the developer documentation.)
  • Set the trigger type to “DOM Ready”.

Learn more about Google Analytics ecommerce.

Enhanced Ecommerce

There are two methods that are used to implement enhanced ecommerce with Tag Manager:

  • Data layer: The preferred method; push ecommerce data to the data layer from your code.
  • Custom JavaScript variable: Create a Custom JavaScript variable in Tag Manager. This variable should return an object with the information that you would otherwise push onto the data layer.

With either method, you should first become familiar with enhanced ecommerce in the Google Analytics before you use Tag Manager to implement enhanced ecommerce tags. You may need to enlist the help of a developer for your data layer implementation.

Important: There are several specific types of information that are available to work with in enhanced ecommerce implementations. Please refer to the developer documentation for a complete list of data types that are supported.

Data layer implementation

  1. In your code, add the ecommerce information to a data layer object called "ecommerce". Refer to the Tag Manager developer documentation for details on how to implement a data layer.
  2. In Tag Manager, create a Universal Analytics tag with these additional settings:
    • Set the Track Type to either Page View or Event.
    • In the Google Analytics Settings variable, under More Settings and then Ecommerce, set Enable Enhanced Ecommerce Features to True.
    • Select Use Data Layer.

Custom JavaScript variable implementation

  1. Create a Custom JavaScript variable. This variable must return an object that contains the ecommerce object.
    In this variable, use the same syntax that would be used to push this data onto the data layer.
  2. In Tag Manager, create a Universal Analytics tag with these additional settings:
    • Set the Track Type to either Page View or Event.
    • In the Google Analytics Settings variable, under More Settings and then Advertising, set Enable Enhanced Ecommerce Features to True.
    • Select Use Data Layer.

Related resources

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Google apps
Main menu
5146083507427153978
true
Search Help Center
true
true
true
true
true
102259
false
false