In my work with clients, I often serve as their e-commerce whisperer – getting implementations to work properly and up to spec. This is the most fun, and often the most challenging, part of my Google Analytics and Google Tag Manager work.
The GA4 e-commerce model is simple to understand, well laid out, and has clear and thorough documentation. So why is it so hard to implement and so often poorly implemented? The GA4 e-commerce model is often hard to implement for these reasons:
- Third-party vendors not implementing all features
- Internal developers not understanding the model
- Re-using old code
- Poor implementation or testing
But you can overcome these challenges. Here’s how to ensure a successful GA4 e-commerce implementation and tips for managing it effectively.
Understanding the Items Array
At the heart of the GA4 e-commerce model is the "items” array.
Items is a template for the information that describes one specific product item. The item might be a dog collar; actions around it might include viewing it, adding it to the cart, and purchasing it.
The “array” is developer-speak for “there might be more than one item.” If you’re shopping for your dog, you may purchase a dog collar and a water dish. The corresponding items array will have two items in it.
What defines an item? Information you’d expect:
- the item name and item ID (at least one of which is required)
- the brand
- the category – up to five levels deep, such as pets / dogs / small dogs / collars
- the price
- the quantity
- and several other parameters that further describe that item you’re trying to sell.
Example
Let’s look at the Google documentation. This screenshot of an items array has two items in it. The same fields – item name and ID, brand, price, etc. – are formatted for and describe each item.
Pretty straightforward – you might say it even makes sense!
Even better, the items array is extensible – you can add your own custom fields or parameters. You might want to add color or size, for example.
Any additional custom fields are called item-scoped custom dimensions. GA4 lets you add up to 10 in the free version and up to 25 for Analytics 360 properties.
(You may have heard about GA4 parameters being “scoped” – user-scoped, session-scoped, item-scoped, etc. An item-scoped parameter simply refers to one that’s within the items array. The one downside of the different scoped parameters is that you often can’t mix them in different reports or Explorations.)
Keep the items array in mind whenever you work with GA4 – it’s at the heart of every e-commerce event.
The Essential E-Commerce Events in Google Analytics
We now understand the items array, and we know it’s at the heart of the GA4 e-commerce model. The next step is to add events (actions) around it.
Google provides a well-defined list of e-commerce events. These events cover everything a user does with an item – view it, add it to the cart, remove it from the cart, view the cart, checkout, etc.
Google is strict about this list. Google will not even recognize an event as an e-commerce one unless you use Google’s name – not your own – for the event. So:
- Don’t create your own event name (something developers love to do).
- Don’t use an older name for that event.
For example:
- In GA4, use “add_to_cart” as the relevant event for, umm, adding an item to a cart.
- Don’t make up an event name and call it “add_to_shopping_basket.”
- Google won’t recognize that event as an e-commerce one, so it won’t show up in the monetization reports in GA4.
- Don’t use “addToCart,” which is the “old” name for that event in Universal Analytics (GA3).
- Google won’t recognize addToCart as a GA4 e-commerce event (unless you do some fancy processing to change addToCart to add_to_cart; believe me, it’s not worth it).
Which events in Google’s GA4 e-commerce model are most important? The good news is that GA4 has a pretty good answer for that, in terms of the two funnels in GA4’s monetization reports.
The purchase journey report comprises five events. The last four are related to e-commerce (session_start is not):
- session_start
- view_item
- add_to_cart
- begin_checkout
- purchase
The checkout journey report covers two additional e-commerce steps (add shipping and add payment):
- begin_checkout
- add_shipping_info
- add_payment_info
- purchase
In short, considering only the GA4 reports, Google rates these events as most important:
- view_item
- add_to_cart
- begin_checkout
- add_shipping_info
- add_payment_info
- purchase
Proper implementation of all six gives you a great funnel that shows your customer’s journey through your e-commerce site.
Why Is the GA4 E-Commerce Model So Difficult?
The GA4 e-commerce model is clear and simple. It provides for an understandable description of an item and a clear list of events.
The tricky part is implementing that model.
Let’s look at one common example – Shopify.
Shopify took a long time to support the GA4 model natively. Once they added support for GA4, it was for a limited set of events:
What’s missing? The add_shipping_info event, one of the steps in GA4’s checkout journey report!
(Note: This is from Shopify’s native GA4 support; multiple third-party plugins and apps offer much more robust GA4 integration.)
Another very popular e-commerce platform is WooCommerce, in WordPress. In that world, the GTM4WP plugin is excellent and very popular.
Unlike Shopify’s native integration, GTM4WP tracks all GA4 e-commerce events, not just the six Google identifies as the most important. For example, GTM4WP will capture a remove_from_cart event or a view_item_list (where a grid of items might appear on a page).
Real-World Implementation Challenges
If you’re running a Shopify or WooCommerce store and using one of the more popular plugins, you’re probably in good shape.
Troublesome issues around e-commerce implementation often have to do with other systems, such as:
- e-commerce sites that use internally developed software
- third-party vendors that offer modified e-commerce systems that are piggy-backed on to other solutions, such as CRM integration or ticket sales
- repurposed Universal Analytics implementations squeezed into the GA4 e-commerce model.
The first two tend to be most problematic. I’ve found that the developers may understand their systems quite well, but they lack understanding of the GA4 e-commerce model.
Even with Google’s great documentation, developers often stray from the standard. They’ll use “cost” instead of “price”; “qty” instead of “quantity”; “category” instead of “item_category.”
(Pro tip: Don’t do that. Such loose terminology can lead to critical errors. Follow the documentation exactly, particularly as it applies to event names and parameter names, and things will go great.)
Even worse, many of these hybrid systems will just ask for your GA4 Measurement ID and promise to send all the e-commerce events. Often, they’ll send just a small subset of the events, and even those may not be implemented properly.
Bottom line: Even though you’re a marketer, you may have to train the developers to implement the model correctly – which means you need to understand the model well AND know how to test the implementation.
Google Documentation: The Key to the GA4 E-Commerce Model
Marketers, if you do end up working with developers, or if you want to dive a bit deeper into the e-commerce model, bookmark the two Google resources I regularly consult.
Both reside in the “developers” subdomain of Google. As a marketer, you may be more used to the “support.google.com” subdomain. It often has great information, but it doesn’t get too technical.
The developers.google.com subdomain does get technical – sometimes very technical. But that’s not the case with the Google Analytics e-commerce pages, which are understandable for non-developers.
The first resource is the overall guide to the e-commerce model. It shows the items array and the various e-commerce events (add_to_cart, etc.)
(Note: The documentation shows different instructions for a (1) Google Tag or (2) GTM implementation. In most cases, as a marketer you don’t have to worry about which implementation to use; the items array and the event names are identical across both.)
As good as this documentation is, it doesn’t describe the parameters. For example, what is the location_id in the items array?
For a description of the parameters, you need a second reference source: the list of recommended events for Google Analytics 4. This describes each parameter and indicates whether it’s required.
Required Fields
I often see implementations fail because they don’t include the required fields. Here’s what Google requires:
For the items array:
- item_name OR item_id (preferably both)
- not required, but relatively meaningless without them:
For all GA4 e-commerce events:
- a valid items array
- currency
- value
- Value is the sum of the quantity price for each item in the items array.
- Pro tip: Price is the amount after any discount.
For the GA4 purchase event:
- a valid items array
- currency
- value
- transaction_id (order number)
Again, these are straightforward requirements. But developers often forget to include them all or attach different names to them. The result: a broken implementation.
Testing the GA4 E-Commerce Model
I’ll end with my favorite part of the GA4 e-commerce model – how to see it in action!
Here’s an overview of one of my favorite ways to test. I’ll show you how to see the e-commerce events and whether, for example, the items array is configured correctly.
To test:
- Have the URL of an e-commerce website ready.
- In Chrome, open a new tab and type in tagassistant.google.com.
- Click the Add domain button.
In the box that comes up, copy, or enter the URL of the e-commerce site (from the first step, above).
If it all works, you should see two Chrome tabs:
- Tag Assistant
- Your e-commerce site.
- In my case, and in the screenshot, I’ll use a demo site where my dog Xuxa sells custom dog toys.
Move around your e-commerce site and do something e-commerce-ish – look at a product or add an item to a cart.
Move over to the tagassistant Chrome tab.
You may see multiple Google tags, like the three in the screenshot. Choose the G-xxxxx one. This will (most likely) be a GA4 Measurement ID.
All the events (and lots of other information) appear in the left-hand navigation. Find an example of an e-commerce event, such as the first view_item in the screenshot. Click on it.
Once that’s open, click on the downward chevron in the API Call section.
You’ll now see the output of the e-commerce package – in this case, how the e-commerce package delivers a view_item event. This information has been sent to the data layer, which is essentially a temporary storage area. Google Tag Manager can grab the information from the data layer, process it, and send it to Google Analytics 4.
Recognizing a Good Implementation
What do we see? In this case, a properly formatted view_item event!
- It has an items array.
- The items array has both an item_name and item_id (at least one of which is required).
- The view_item event has the required currency and value parameters.
You should be able to recognize this e-commerce event as properly formatted, based on what we covered earlier in this post.
Recognizing a Garbage Implementation
What tips off an improperly formatted e-commerce event?
The add_to_cart event in the next screenshot has many flaws:
- It has no currency or value parameters. Both are required.
- The items array is not properly formatted.
Google Tag Manager won’t be able to process this as a valid e-commerce event.
Testing Tips Going Forward
I’ve shown a tiny part of the testing you need to do on an e-commerce site. Play with tagassistant and an e-commerce site on your own. The beauty of tagassistant is that you can use it on any site, whether or not you have access to the analytics of that site. So play around and see how other e-commerce sites are structured. See whether they’re set up properly.
Pro tip: E-commerce implementations often fail with the add_to_cart event. Typically, a customer can add an item to a cart in three places:
- On a view_item_list page
- This page shows a number of products, any of which can be added to a cart.
- On a view_item page (the product detail page)
- In the cart itself, where the customer can often add more items.
Check out some e-commerce sites. See if they correctly deal with all three instances of the add_to_cart event. Spoiler alert: Many times they don’t.
Become an E-Commerce Whisperer Yourself
Dealing with e-commerce implementations and nuances is one of the most crucial aspects of the digital marketing world.
You too can become an e-commerce whisperer by:
- Understanding the GA4 e-commerce model
- Understanding the components of the items array
- Understanding the different e-commerce events
- Knowing what’s required at each e-commerce event
- Knowing how to test an implementation and how to peek at how any e-commerce store is set up.
Now it’s up to you. Dive into tagassistant.google.com and start experimenting – with your own site and any other site. Explore how different sites manage common e-commerce events, such as viewing an item or adding it to the cart. Better yet, the next time you make a purchase online, track the entire process – from session_start to purchase – and see if the site is doing everything right.
Still struggling with your GA4 e-commerce implementation or best practices for management? Our expert analytics team is here to help! Watch a replay of Fred’s recent webinar, Cracking the Code of GA4 E-Commerce Tracking, for additional insights. And reach out to us anytime.