HAMZA EL KHARRAZ

As we will see in this article, the GA4 ecommerce tracking model has definitely some key differences that distinguish it from its predecessor, namely the use of different parameter and event names. However, the approach to setting up GA ecommerce tracking is more or less the same.   

Common mistakes when setting up GA4 ecommerce tracking

Avoiding common ecommerce setup errors will spare you needless wasted time trying to understand where your configuration went wrong. This can be can quite tricky if you don’t carefully follow the guidelines provided in the official documentation

Scraping the DOM for ecommerce keys:

Scraping the DOM allows you to access the content on your page. For instance, this can be useful to extract the name or price of a product displayed on a product page.

Scraping the DOM method can be quite unreliable. Minor HTML tweaks, such as performing A/B testing, can break your tracking. Since the data layer is less prone to errors, it should always be your go-to method for ecommerce tracking.

Not following the recommended data layer structure:

When it comes to ecommerce data layers, the structure is critical. A common error is to not include the ecommerce key in the data layer or items. This can easily break your tracking.

Your data layers should look more or less like this:

Using different key names other than the recommended GA4 ecommerce event names in the official documentation is another common error that can result in a suboptimal configuration. For instance, using a random item_impression, instead of view_item.

Focusing too much on required parameters:

Google has a list of required parameters for each event. Not including them will cause quality issues in collected ecommerce data. 

Some people go to extremes and include only the required parameters for each event. Although there is nothing wrong with this approach, the purpose of having ecommerce tracking in the first place is to better understand how buyers navigate your site.

Including as many relevant parameters as possible in your data layer will provide you with a much clearer picture of what’s going on in your website.

Overcomplicating your Google Tag Manager set up:

There is no need to configure multiple tags, as it was the case a few years ago. GTM has a feature that detects e-commerce data layers.  

This one tag solution makes it much easier to configure ecommerce events and spotting errors in individual events. 

GA4's e-commerce tracking, what has changed ?

Data measurement model difference:

Google Analytics 4 (GA4) uses a different data measurement model compared to Universal Analytics (UA). In GA4, every interaction with a website or app is considered as an event. Conversely, in UA, the user’s actions are associated with a session and categorized by action type such as e-commerce, social, and page views, etc.

Different names for GA4 parameters:

The majority of the legacy products scoped keys found in the data layer (or ecommerce dimensions in GA4) have been replaced by items scoped keys.
For example, the key currencyCode is no longer used. Instead, the key currency is now used to represent the currency of a transaction (doesn’t exist on products level in UA) in the data layer (or ecommerce dimensions in GA4).

List of GA4 ecommerce items parameters

GA4 parameter UA parameter Description
item_id
id
The ID of the item
item_name
name
The name of the item
item_category
category
The first category level of the item.
item_category2
category
The second category level of the item.
item_category3
category
The third category level of the item.
item_category4
category
The fourth category level of the item.
item_category5
category
The fifth category level of the item.
currency
N/A
The currency of the item. Exists only on the event level in UA.
quantity
quantity
The quantity of the item
price
price
The price of the item
coupon
coupon
The coupon associated with the item
affiliation
N/A
Affiliation associated with the store
index
position
The position of the item in a list
item_brand
brand
The item’s brand
discount
N/A
The discount on the item
item_variant
variant
The variant of the item (i.e, small, medium, large)
item_list_name
list
The name of the list that contains the item
item_list_id
N/A
The ID of the list that contains the item

A word on migration from UA ecommerce tracking:

Incompatibility issues with the new GA4 schema

The main issue when migrating from a Universal Analytics set up is the incompatibility between the two data layer models. Although GA4 is capable of translating the UA data model, There are some critical ecommerce events that do not exist in UA

GA4 event UA event
view_cart
N/A
add_shipping_info
N/A
add_to_wishlist
N/A
Some other ecommerce events have partial compatibility issues. For instance, in the UA data model, we had to define each checkout step. In GA4, we are working with predefined checkout steps that include events such as add_payement_info and add_shipping_info. These new events have parameters that aren’t supported by UA, such as value.

This means that you will have incomplete GA4 reports for these checkout events.  It’s fine of course if you are trying to have only the bare minimum to get by, but in most cases setting up a proper data layer with GA4 schema is the way to go.

Workarounds to mitigate GA4/UA compatibility issues

You can solve partial compatibility issues by using the EEC products to GA4 items custom variable template. This custom variable template is a great solution for migrating from the enhanced ecommerce schema.

This custom variable template can map UA products and send it to GA4 with the required items array, without having to change the keys in your data layer.

Implementing GA4 ecommerce events with GTM

One GTM tag to manage all ecommerce events :

Instead of individually implementing each tag and spending a good chunk of time copy-pasting parameters across tags, you can use one tag and let GTM get the data automatically from the corresponding data layer of each event:

All you really need to do is to configure your trigger correctly. By checking the “use regEx matching” option, GTM will send ecommerce data if it finds any of the events separated by the pipe (the symbol for “or”).

The Tag will fire only if either of the events separated by the pipe are contained in the data layer. 

That’s all you have to do. Save the trigger and do a test before publishing, and you are done.

Get weekly tips on how to make the most of your analytics set up

Part 1 – Ecommerce data layers : the purchase funnel

Although this section is about constructing an ecommerce funnel, if you’ve already used GA4, you might have noticed that there isn’t really a dedicated section for analyzing the purchase funnel in Universal Analytics. This may change as GA4 rolls new updates, but it doesn’t mean that you can’t construct your own funnel in the exploration section. 

All you really need is the ecommerce events that form the typical purchase steps on your website. We will start the purchase funnel from the moment the user sees your product in a product category list to when they make the actual purchase.

Viewing an item list

Description

The event will be triggered each time the user views a list of items, such as a dedicated section for bestsellers on your website or a page for a specific product category.

Data layer structure for view_item_list

We don’t have the promotion data anymore, instead, we are left with the regular items. The most important keys in the data layer are the item_list_name and item_list_id, which describe the list viewed by the user.

Selecting an item from a list

Description

Each time the user selects an item from any list on your website, GA4 will receive a <code>select_item</code> event.

Data layer structure for select_item

The only change from the previous data layer is the event name, and having only one item in the data layer. 

Viewing an item page

Description

The user lands on the product details page. 

Data layer structure for view_item

Adding an item to cart

Description

Data layer structure for add_to_cart

The user clicks on “Add to cart” button.

Viewing the cart

Description

The user goes to the cart section of the website.

Data layer structure for view_cart

Starting checkout process

Description

The user starts the checkout process with the selected items. This event can trigger once the user clicks on some type of “validate order” button. 

Data layer structure for begin_checkout

Adding shipping details

Description

The user adds and validates his shipping information. 

Data layer structure for add_shipping_info

Besides the usual items, we added the shipping_tier (the chosen method of delivery).

Adding payment details

Description

The user chooses a payment method, and fills payment details. 

Data layer structure for add_payment_info

Completing the purchase

Description

The user validates his order and gets redirected to some type of “thank you page”. 

Data layer structure for purchase

The added parameter to this data layer is payement_type (the chosen method of payment).
Items data (optional)

We have a bunch of new parameters for the purchase event, such as transaction_id, shipping, and tax

Part 2 – Other ecommerce events

The second part focuses on ecommerce events that might not be a part of the checkout process, but can be nevertheless important in understanding the user’s behavior.

Promotion impression

Description

view_promotion will trigger each time the users seems any sort of promotional banner on your website.  

Data layer structure for view_promotion

The view_promotion event has the usual items key, which is common to almost all the ecommerce events.  Multiple items can be included in this data layer depending on the promotion you are running.
Promotion data :

The promotion part of the data layer breaks down the detail of the promotion with the following parameters :

  • promotion_name (required):  the name of the promotion (campaign) you are running.
  • promotion_id: the ID of the promotion.
  • creative_slot: the location of the banner on the website. This is very useful for testing the impact of banner placement on conversion rate.
  • creative_name (optional): name of the creative. 

Step 2: select a promotion

Description

The user clicks on a banner or an item on promotion.

Data layer structure for select_promotion

Besides the event name, there are no major changes to the data layer. You can have just one item instead, if the promotion sends the user to the product page. 

Add product to wishlist

Description

The user adds a product to the favorites list. 

Data layer structure for add_to_wishlist

This data layer has a similar structure to add_to_cart.

Remove product from cart

Description

The user removes a product from the cart.

Data layer structure for remove_from_cart