GA4 ecommerce (Tag Manager): Send Universal Analytics events

This guide describes how to use an existing Universal Analytics (Tag Manager) ecommerce implementation to send ecommerce events to a Google Analytics 4 property.

Visit the Developer migration center for additional migration guides and resources.

Outcome

The outcome of following this guide is that your existing Universal Analytics implementation will be used to populate a new Google Analytics 4 property. Your existing Universal Analytics implementation will remain unchanged, your UA ecommerce reports will continue to be populated with data, and you will begin receiving data in your new Google Analytics 4 property.

Before you begin

  1. Use the ecommerce migration helper tool to confirm that the following describes your current implementation:

    • You are using a Universal Analytics property
    • Your site uses Tag Manager and is Using the Data Layer to send ecommerce events
  2. Review the migration options for ecommerce implementations to learn about the trade-offs of each option. Confirm that you do indeed want to follow this guide to use your existing Tag Manager Universal Analytics implementation for Google Analytics 4.

  3. Review the Event compatibility reference to learn how UA events are translated when sent to a GA4 property.

Trade-offs and considerations

Review and consider the information below to fully understand the implications of using your existing Universal Analytics (Tag Manager) ecommerce implementation with a Google Analytics 4 property.

Pros Cons
  • Easiest option to implement since you don't change your existing ecommerce data layer implementation.
  • Allows you to see ecommerce data in both your GA4 and Universal Analytics reports.
  • No change to how your ecommerce data is collected or reported in your Universal Analytics property.
  • Events related to Checkout progress and Checkout options do not easily map to GA4 events. It is likely that checkout option information will not appear in GA4 ecommerce reports.
    • If you send events for unsupported checkout progress and options, their associated parameters will be treated as custom events and custom parameters in GA4. However, data will not be sent to Google Analytics for the items parameter (it is not supported).
  • The Add Shipping Info step in the GA4 Cart Detail/Fallout Funnel report will be empty.
  • The List Clicks step in the GA4 Merch/Product/Item List Funnel report will be empty.
  • The / delimiter for category is not recognized in GA4. GA4 will report cat1/cat2/cat3 as a category instead of three categories, i.e. cat1, cat2, and cat3.

Implementation

1. Create and configure a new GA4 property

Complete the following steps to create and configure your new Google Analytics 4 property:

  1. Create a new Google Analytics 4 property.
    • Use the GA4 Setup Assistant to automatically create a new GA4 property and copy the following settings from your Universal Analytics property: property name, website URL, timezone, and currency settings. However, uncheck the Enable data collection using your existing tags option to disable the connected site tag feature. Alternatively, if you don't want to copy any settings from your Universal Analytics property create a Google Analytics 4 property without the GA4 Setup Assistant.
  2. Add the Google tag.
    1. Open the Google Tag Manager container for your existing Universal Analytics implementation.
    2. Click Tags > New.
    3. Click Tag Configuration and select Google tag.
    4. Enter the Measurement ID of your Google Analytics 4 property.
    5. Select to trigger the tag on All Pages (or on the subset of pages you want to measure).
    6. Save and publish your tag configuration.

2. Add GA4 Event tag configurations to measure ecommerce events

For each Universal Analytics tag configuration, you will need to add a GA4 Event tag configuration to measure the equivalent ecommerce event in GA4.

For each Universal Analytics ecommerce event, the general steps to create the corresponding GA4 event are as follows:

  1. Create a new Tag Configuration and select GA4 Event.
  2. For Event Name use the Compatibility between UA and GA4 events table and/or the ecommerce migration helper to find the appropriate GA4 event name for the Universal Analytics ecommerce activity. For example, if you're creating an event to measure product impressions, the GA4 event name would be view_item_list.
  3. Under More Settings and then Ecommerce, check Send Ecommerce data.
  4. For Data Source select Data Layer.
  5. In the Triggering section, choose the appropriate trigger to make the tag fire. This should be the same trigger used for the corresponding Universal Analytics ecommerce event.
  6. Click Save.

Repeat the steps above for each Universal Analytics ecommerce activity. Publish your changes when complete.

Example: UA to GA4 Event

The following example shows how to create an equivalent GA4 Event for a product click ecommerce activity implemented in Tag Manager for Universal Analytics.

The following Measures a Product Click for Universal Analytics, implemented Using the Data Layer. The custom event name is productClick.

<script>
/**
 * Call this function when a user clicks on a product link. This function uses the event
 * callback datalayer variable to handle navigation after the ecommerce data has been sent
 * to Google Analytics.
 * @param {Object} productObj An object representing a product.
 */
function(productObj) {
  dataLayer.push({
    'event': 'productClick',
    'ecommerce': {
      'click': {
        'actionField': {'list': 'Search Results'},      // Optional list property.
        'products': [{
          'name': productObj.name,                      // Name or ID is required.
          'id': productObj.id,
          'price': productObj.price,
          'brand': productObj.brand,
          'category': productObj.cat,
          'variant': productObj.variant,
          'position': productObj.position
         }]
       }
     },
     'eventCallback': function() {
       document.location = productObj.url
     }
  });
}
</script>

In Tag Manager, the Universal Analytics tag configuration is as follows:

Tag type : Universal Analytics
Track type : Event
Event Category: Ecommerce
Event Action: Product Click
Enable Enhanced Ecommerce Features: true
Use Data Layer: true
Trigger: event equals productClick

A Universal Analytics tag configuration for a product click

The trigger configuration is set to fire the tag when the productClick event is pushed to the data layer:

A trigger configuration for the productClick custom event

To use the UA implementation above to send data to GA4, the following equivalent GA4 event is configured:

Tag type : GA4 Event
Event Name: select_item
Send Ecommerce Data : true
Data Source: Data Layer
Trigger: event equals productClick

A GA4 Event tag configuration for a product click