In our last GA4 article, we walked through setting up the GA4 Configuration Tag to start collecting data. The standard GA4 implementation automatically collects events such as pageview, scrolling, video actions, view search results, etc., but it doesn’t capture everything such as ecommerce purchases.

Although revenue reporting is lacking in GA4, we’ll navigate through the setup and configuration required to start collecting revenue data. If you’d rather have help from a specialist, our Technical & Analytics team is happy to set up GA4 ecommerce tracking for you.

Contact us

Getting Started with GA4 Ecommerce Tracking

The following setup is intended for people running Universal Analytics (UA), Google Tag Manager (GTM) and the Enhanced Ecommerce Revenue dataLayer. This guide will map your existing Enhanced Ecommerce dataLayer to the new GA4 standard from an order confirmation page.

We’re going to dive right into the hard stuff first as it makes the GA4 Purchase Event Tag setup much easier. Let’s start with creating the revenue Data Layer Variables in GTM. Skip to step 2 if revenue dataLayer variables already exist in your GTM Container.

Step 1: Defining Revenue Layer Variables

In order to collect revenue data in GA4, revenue variables from your existing Enhanced Ecommerce dataLayer have to be defined as Data Layer Variables in GTM.

Here is an example of an Enhanced Ecommerce dataLayer from our order confirmation page:

event: ‘transaction’,
ecommerce: {
purchase: {
actionField: {
id: ‘6692682’,
revenue: ‘57.24’,
tax: ‘3.24’,
shipping: ‘5’,
coupon: ‘wtmcoupon’
products: [
id: ‘94856W’,
price: ’49’,
category: ‘Clothing’,
quantity: 1

We’ll be first tackling the parameters under the purchase array, being ID, revenue, tax, shipping and coupon. Here is how you begin:

  • First, navigate to Google Tag Manager and enter your Workspace.
  • Next, go to ‘Variables’ from the left hand navigation, scroll down to ‘User-Defined Variables,’ and click ‘New.’
  • Click ‘Variable Configuration’ and select ‘Data Layer Variable’ from the Variable Type list.
  • In the ‘Data Layer Variable Name’ field we’re going to enter: ecommerce.purchase.actionField.revenue, as that is the hierarchical order of the Revenue variable from our example above.
  • Ensure ‘Version 2’ is selected for the Data Layer Version and name your variable
  • Click Save.

Repeat the same steps above and create Data Layer Variables for the id, shipping, tax and coupon parameters. We’ll be using the following values for these parameters:

  • ecommerce.purchase.actionField.shipping

This takes care of the parameters from the purchase array.

Defining the Products Array

Next, we’ll have to define the parameters from the products array. This requires a different configuration, as multiple products can be included in the products array. Luckily, there is a GTM variable template available that makes this implementation a little easier for us.

  • Go to Templates from the left hand navigation.
  • Click Search Gallery in Variable Templates, search and select ‘EEC dataLayer Builder for GA4.’
  • Hop out of Templates and navigate to Variables from the left hand navigation.
  • Scroll down to User-Defined Variables and select the newly added ‘EEC dataLayer Builder for GA4’ from the right handed menu.
  • Within the variable, select ‘Items’ from the Mode dropdown menu. There are two available functions with this variable template but we’ll be using this to populate the items from the products array.
  • Name your variable and hit Save.

Step 2: Creating the Purchase GA4 Event Tag

Now that we have all of the variables created, let’s create the purchase GA4 Event Tag.

  • First, create a New Tag.
  • Select ‘Tag Configuration’ and choose ‘Google Analytics: GA4 Event’ as the Tag Type.

The Event Tag is going to look a little different if you’re used to the Universal Analytics Event Tag. Event Category, Action and Label are no longer available with GA4.

  • In the Configuration Tag drop down setting, select your Configuration Tag.
  • For Event Name, enter ‘purchase’ into the Event Name field.

Translating Data Variables to GA4 Parameters

Next, we’ll be mapping the revenue Data Layer Variables from Step 1 to the corresponding GA4 parameters.

As mentioned earlier, GA4 parameters have new naming conventions that need to be mapped out for our purchase event. For example, ‘id’ from the purchase array will become ‘transaction_id’ and ‘name’ in the products array will become ‘item_name.’

Here is a table of GA4 Parameters necessary for our GA4 Purchase Event Tag.

GA4 ParameterUniversal Analytics ParameterDescription

value revenues Transaction revenue
transaction_id id Unique ID for the transaction purchase (Required)
currency currencyCode Local currency (Required)
tax tax Taxes from purchase
shipping shipping Shipping costs from purchase
coupon coupon Coupon code associated with purchase
items products List of products purchased from transaction

In the GA4 Event Tag, expand the ‘Event Parameters’ section. In the left hand column ‘Parameter Name’, enter the GA4 parameters. In the right hand column ‘Values’, enter the corresponding Data Layer Variables from Step 1.

This step is important because it will populate the revenue data into GA4. The ‘items’ GA4 Parameter will be mapped to the template variable created from Step 1.
We will also set ‘currency’ to USD because our store doesn’t sell outside of the United States. If you sell internationally and the currency value changes dynamically, you’ll have to create a currency Data Layer Variable for it.

Configuring the Trigger

Next, the purchase Event Tag will need to fire on the order confirmation page after the user completes the purchase. This can be a unique confirmation page or a custom event that is fired.

For example, our revenue dataLayer fires a custom event labeled ‘transaction.’ Our revenue dataLayer only fires after a successful purchase so I created a custom Event Trigger for this event.

To ensure this Tag fires only on the order confirmation page, I added a condition to my Custom Event Trigger to fire on the ‘order-review’ page.

Need more help? Reach out to our team and we can set up your GA4 ecommerce tracking.

Get Help with GA4

Testing the Purchase Event

To ensure that we have set this up correctly, let’s test our purchase Event in GTM Preview Mode. Enter GTM Preview Mode and complete a successful transaction on your website.

In GTM Preview Mode, we can review event hits sent to GA4 in real-time. From the top left of the Preview window, you can switch between the GA4 and GTM containers. Switch to the GA4 container by selecting your GA4 Measurement ID.

After clicking the fired Purchase Tag, we see the following data sent to GA4. A successful transaction hit will display values for the parameters we defined earlier. This allows us to not have to wait for the data to process in GA4 to confirm our setup is working correctly.

If the Purchase event fires and the values look correct in Preview Mode, publish your container to set it live for all users.

The last test of a successful implementation is reviewing GA4’s Monetization report. Review the Overview and Ecommerce Purchases report for the event data. You should see Revenue, Transactions and the names of products purchased.

Please note that it can take several hours for data to process and become available in the GA4 reports. Transactions have a much larger lag when compared to Universal’s processing times.

Keeping Updated on GA4’s Changes

GA4’s Monetization report isn’t as robust as UA’s Ecommerce reporting but collecting data now will allow you to collect historical data. Google is still rolling out new changes to GA4 so check in often to learn more about its features and enhancements.

Don’t forget to explore other event actions available related to Ecommerce such as add_to_cart, view_item, begin_checkout and add_to_wishlist to collect more GA4 data.

Not sure where to start with GA4? Need help with generating revenue and getting your products in front of users? Start a conversation with WTM’s seasoned team.