Vertigo Agency | Owl eyes on digital

Step-by-Step Guide to Google Analytics 4 eCommerce Tracking3 min read

Flavia Groza-Bocăneț marketing specialist

FLAVIA BOCĂNEȚ Marketing Specialist & the owl

Îmi lansez amprenta digitală în lume prin colaborări cu însemnătate. Ofer la schimb creativitate, doze concentrate de educație digitală și punchline-uri pentru meeting-uri mai mult decât vesele.

In this guide, we will walk through the process of setting up e-commerce tracking for Google Analytics 4 (GA4) using Google Tag Manager (GTM).

This setup is crucial for online store owners to analyze sales, properly configure conversions, and boost the success of Google Ads campaigns. Although we will focus on WordPress sites with WooCommerce integration, the principles are applicable to other platforms as well. Let’s dive in! ✌️

I uploaded a step-by-step YouTube video in the Romanian language. English subtitles are available.

Why E-commerce Tracking in GA4 is Essential

Implementing e-commerce tracking in GA4 allows you to:

  • Track product views, cart additions, and purchases
  • Analyze revenue and sales data
  • Optimize marketing strategies and ad spend
  • Enhance user experience on your online store

Prerequisites

Before we begin, ensure that your website has data layers built-in. These data layers will enable Google Tag Manager to extract user interaction data and send it to GA4. This data includes product views, cart actions, purchases, and revenue information.

Types of E-commerce Events in GA4: Google’s documentation outlines several types of e-commerce events that can be tracked.

Subscribe to Marketing Newsroom, and you will receive the newsletter every Wednesday.

*Note: the newsletter uses Romanian language.

1. Setting Up Data Layers

First, we need to ensure that our data layers are correctly implemented. If you’re using WooCommerce on WordPress, follow these steps:

  • Install and Activate GTM Plugin: Go to your WordPress dashboard, navigate to Plugins > Add New, and search for ‘gtm 4wp’. Install and activate the plugin
google tag manager for wordpress
  • Configure Plugin Settings: In the plugin settings under the General tab, add your Google Tag Manager ID. Turn off unnecessary options and save changes.
ecommerce tracking ga4
  • Set Up WooCommerce Integration: In the Integration tab, enable tracking for e-commerce, cart content, customer data, and order data in the data layer.

 

gtm4wp plugin

2. Creating Tags and Triggers in GTM

  • Create a New Tag: In GTM, create a new tag and name it ‘Google Analytics 4 E-commerce’. Select the GA4 Event tag type.
ecommerce tracking Google Analytics 4
  • Enter Measurement ID: Input your GA4 data stream ID. You can create a constant for the ID to simplify the process.
google analytics 4 stream id
  • For the Event Name choose the Event, custom event. In More Settings, choose Send Ecommerce Data and leave the Data Layer option enabled. In Advanced Settings, go to Consent Settings and choose No additional consent required, since this is a Google tag with built-in consent. However, make sure you have done the setup according to this Consent Mode v2 article.
events google tag manager
  • Set Up Triggers: Create a trigger named ‘eCommerce All Events’ and set it to fire on custom events matching the e-commerce events from Google’s documentation. Enable Use regex matching and add these events: 

view_item|select_item|add_to_cart|remove_from_cart|view_cart|begin_checkout|

add_payment_info|add_shipping_info|purchase

The tag will fire when any of these events will happen in the user’s journey. Save the trigger and then save the tag.

Configuring GA4 e-commerce events

3. Testing and Publishing

  1. Simulate a Purchase: Use GTM’s preview mode to simulate a purchase on your site. Add a product to the cart, proceed to checkout, and place an order.
  2. Check Data Layer and Tag Activation: In Tag Assistant, verify that the tags are firing correctly and that the data layer contains the expected information.
  3. Publish Changes: Once confirmed, publish your GTM container to make the changes live.
Testing GA4 e-commerce tracking
Google Tag Manager data layer setup
E-commerce reporting in GA4

Verifying E-commerce Tracking in GA4

After setting up and publishing, navigate to your GA4 property to verify that e-commerce data is being collected. Check the e-commerce reports to ensure they display accurate and comprehensive data about user actions on your site.

Conclusions

Setting up e-commerce tracking in Google Analytics 4 using Google Tag Manager is a powerful way to gain insights into your online store’s performance. By following this guide, you can ensure that your e-commerce data is accurately tracked and leveraged for better business decisions.

Don’t forget to subscribe to our channel for more tutorials, and stay tuned for more insights on using Google Tag Manager and Google Analytics 4.

Thoughts? You can message me here.
Flavia Groza-Bocăneț

Sharing is caring!

Abonează-te la newsletter-ul săptămânal Marketing Newsroom.