[UA→GA4] Migrate ecommerce data collection from UA to GA4

[UA→GA4] Migrate ecommerce data collection from UA to GA4

Best practices for setting up ecommerce data collection in Google Analytics 4 properties

The names of some ecommerce events and parameters have changed for Google Analytics 4 properties. Using the correct GA4 names and parameters will give you the most useful ecommerce reporting and ecommerce event data in your GA4 property.

To migrate from UA to GA4, you should

If you use your existing UA ecommerce implementation (i.e. dataLayer events and gtag.js code) with a GA4 property, your GA4 ecommerce reports will not be complete. The gtag.js library automatically translates some, but not all of the UA event and parameters to what is needed for GA4.

On the other hand, you should not simply switch to the GA4 event and parameter names either. UA will not collect any data for events that it doesn't recognize. For example, all GA4 ecommerce events have the parameter instead of .

Because of this, the best practice is to have two implementations in place: one for UA and one for your GA4 property.

Since this will result in sending two events where you would ordinarily only send a single event, you may decide to rely on your UA implementation, and add only the additional events/ parameters required to send data to GA4 properties. However, this requires a deep understanding of the two different sets of events and parameters. If you keep your UA dataLayer structure and objects,

An event specifies how to interpret the product, list, and/or promotion data that you send. Parameters pass more specific information about an event.

If you do not include the required parameters for ecommerce-specific events (e.g. , , ), these events will not show up in your GA4 ecommerce reports. Instead, they will be reported as custom events.

The following table describes the individual items array parameters that are available for collection.

Some names have changed, for example, the data layer parameters that used to be “impression” or “product” are now consolidated into .

There is now an array.

How to use this table:

*New or changed event name fromUA

The following event names in UA are considered ecommerce events in GA4 properties:

When one of the above events is sent to a GA4 property via the gtag.js API, GA4 ecommerce event processing will look for an key in the event model. If found, the parameter will be parsed as an array of up to 200 items, where each item is an object with a predefined schema. For each item, GA4 ecommerce will transmit data in any field from a predefined list. The following will be the initial predefined fields for an item:

If you don't update your event instrumentation from UA, you will no longer see the following events in your GA4 ecommerce reports, because the old event names won't be recognized. Create a duplicate event with the correct name for your GA4 property.

GA4 properties introduce additional item-level parameters, eg. affiliation, currency, and a few item_category parameters. You will not get the benefits of these additional parameters if you don't retag. However, these additional parameters are optional and won't break if you don't use them.

To take advantage of new events introduced for Google Analytics 4 properties, you'll need to add new events and parameters to the dataLayer, add new event triggers in Google Tag Manager, and implement a separate dataLayer that captures information about the items you sell.

When configuring an GA4 Event tag in Google Tag Manager to send an ecommerce event using the dataLayer, you have to manually enter dataLayer variables as event parameters, such as param name: ‘’ and value , where is a Tag Manager dataLayer variable that needs to be created to read the products array from the dataLayer. You need to create a dataLayer variable for each event-level parameter and assign it to an event parameter, and then repeat for each ecommerce event. See the example below for details.

There are typically four steps in a purchase funnel:

User views an item or a list of items. To measure item list views/impressions, push a list of items to the dataLayer and collect an event along with that data. 

User selects an item and adds it to their cart. Variations of this could include adding to a wishlist or sending a request for more information.

User goes to their cart with an item and begins the checkout process. Additional steps such as adding payment or shipping information have their own GA4 events. If your checkout flow includes these additional steps, be sure to send specific events for them so that they can be included in your purchase funnel.  

GA4 properties can capture additional information as well:

Images Powered by Shutterstock