Notification

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

[UA] Universal Analytics e-commerce

Use Tag Manager to implement Google Analytics e-commerce tags.
Note: This article refers to Universal Analytics e-commerce. Google Analytics 4 is the future of Google Analytics. It's recommended that you implement and send GA4 e-commerce events to ensure that you can take advantage of all Google Analytics features in the long term. To learn how to implement e-commerce measurement with Google Analytics 4, read the developer documentation. To learn how to migrate your e-commerce implementation from UA to GA4, see the new GA4 e-commerce migration guide.

There are two main types of Universal Analytics e-commerce implementation methods: Standard e-commerce and enhanced e-commerce.

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

Enhanced e-commerce adds additional functionality to standard e-commerce reports. Enhanced e-commerce shows when customers added items to their shopping baskets, when they started the checkout process, and when they completed a purchase. You can also use enhanced e-commerce 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 e-commerce tags.

Standard e-commerce

To set up a standard Universal Analytics e-commerce tag:

  1. Log in to your Google Analytics Account and enable e-commerce for the view that 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 that 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 shop string
transactionTotal (Required) Total value of the transaction numeric
transactionShipping (Optional) Delivery 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 e-commerce data above the Tag Manager container snippet, you can try one of these solutions:

  • Have the tag fire based on a custom event further 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 e-commerce.

Enhanced e-commerce

There are two methods that are used to implement enhanced e-commerce with Tag Manager:

  • Data layer: The preferred method; push e-commerce 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'd otherwise push onto the data layer.

With either method, you should first become familiar with enhanced e-commerce in the Google Analytics before you use Tag Manager to implement enhanced e-commerce 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 e-commerce 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 e-commerce information to a data layer object called ‘e-commerce’. 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 E-commerce, set Enable enhanced e-commerce 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 e-commerce 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 e-commerce 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
18203862386056077964
true
Search Help Centre
true
true
true
true
true
102259