Blog

How to Use GA4 for Enhanced Tracking in Ecommerce

Written by Jakub Jamny | 6/17/24

The goal of this article is to explain how GA4 can transform the way e-commerce measurement is done, and offer a comprehensive approach to leveraging data for better business results.

Content

Introduction

Why GA4 Is Crucial for Ecommerce Companies

Setting up Enhanced Ecommerce in GA4

Conclusion

FAQ

Introduction

Today we will dive into the world of analytics and try to explain how important it is to properly decrypt data from your eshop. If you're an online retailer using platforms like WooCommerce, Shopify, Magento, etc., you've probably already noticed how critical understanding and analyzing your customer journey is to the success of your business. 

With the major upgrade that took place on July 1, 2023, when the standard Universal Analytics features stopped processing data, it's now far more important to stay one step ahead of your competition when it comes to analytics.

Why GA4 Is Crucial for Ecommerce Companies

GA4 has gradually become one of the key tools for ecommerce website owners, bringing a new way to manage growth and success. It offers a range of benefits, from in-depth data collection and analysis to sophisticated event tracking and AI-based insights. This enables you to create strategies based on reliable data, improve marketing activities and increase overall user satisfaction.

In addition, GA4 offers superior cross-platform and cross-device monitoring capabilities that provide a comprehensive view of customer behavior, which, along with more detailed demographic and behavioral information, facilitates the creation of more targeted and personalized marketing initiatives. In addition, the availability of real-time reporting and collaboration tools enables rapid adaptation to changing market dynamics and the exploitation of emerging opportunities.

But how to achieve these benefits? That's what we'll look at in the following sections. But before that, we'll introduce the metrics you should be tracking in Enhanced Ecommerce Tracking:

Metrics to Track in Enhanced Ecommerce

  • Product views on category pages
  • Clicks on product listings
  • Visits to product pages
  • Adding and removing items from shopping carts
  • Engagement with internal promotional content, including banners, videos and pop-ups
  • Interacting with advertising banners
  • Initiating and progressing through the order process, which can be further broken down into detailed steps such as entering contact details, selecting delivery options or entering payment details, each of which can be tracked via a dedicated funnel
  • Completing the purchase
  • Refund processing

Setting up Enhanced Ecommerce in GA4

The key to gaining a better understanding of ecommerce metrics is to enable the Enhanced Ecommerce feature in GA4. This tracking offers invaluable insights into the sales performance of your digital store.

In this section, we'll walk you through setting up Enhanced Ecommerce in various ecommerce interactions, while sharing best practices and tips for the most accurate measurement. In addition, we'll also cover the most common configuration difficulties and give you tips on how to solve them.

To take advantage of advanced measurement for ecommerce in Google Analytics 4, follow the guide below:

Data Integration Tools

Your website can provide GA4 data through a number of tools, including:

  1. Google Tag Manager (GTM): Makes it easy to add and monitor snippets of tracking and analytics code on your website.

  2. Global Site Tag (gtag.js): This tool is designed to embed GA4 tracking code directly into the code structure of your website.

  3. Google Analytics 4 Data Flows: A feature within GA4 that enables tracking across websites, mobile apps, and other digital interfaces.

  4. Google Analytics Measurement Protocol: Offers an API that allows detailed user interaction data to be passed to Google Analytics, ideal for tracking offline activity or more complex interactions.

  5. Third-party tag management solutions: Platforms such as Tealium or Adobe Launch offer advanced integration and management of analytics tags.

  6. Plugins for CMS or ecommerce platforms: Various content management systems and ecommerce platforms provide plugins that simplify GA4 integration.

  7. SDKs for mobile apps (such as Firebase): These are essential for incorporating GA4 tracking features into mobile apps.

In our opinion, Google Tag Manager is the most suitable tool for transferring data from your ecommerce store to Google Analytics 4. This is primarily due to the convenience of adding and editing tags and code snippets on web pages without the need for developer intervention, which is highly efficient for website owners.

Step 1: Set up Google Analytics 4 and Google Tag Manager

  • Set up your Google Analytics account: if you don't already have an account set up, go to the Google Analytics website and sign up. 

  • Create a GA4 property: After logging into Google Analytics, proceed to create a new property. This will serve as the hub of where all the data from your website will be collected.

  • Sign up for Google Tag Manager: Go to the Google Tag Manager website and create an account. 

Step 2: Implementation of GTM on Your Website

  • Embedding the GTM code on your website: Once you have obtained the GTM code snippet, follow the instructions to insert it between the <head> and <body> tags of your website's HTML code.

Step 3: Data Layer Setup

  • Understanding the data layer: Think of the data layer as a digital diary that records activity on your site, such as product views.

  • Adding a data layer: This step involves embedding JavaScript code on your site to enable data layer functionality. If programming is not your forte, you may need to use the services of a developer. This script ensures that the data layer captures details of user interactions.

  • Populating the Data Layer: Every time you interact in the store, such as browsing the product list or selecting a product, you must enter relevant information into the data layer. This information includes aspects such as product name, ID, price, brand and category.

Step 4: Setting the Data Layer Variables in GTM

  • Access GTM: Go to the control panel of your GTM account.

  • Start creating a new variable: Select "Variables" and then "New".

  • Configure the variable: Give the variable a name (for example, "GA4 Ecommerce DataLayer") and select "Data Layer Variable" as the type.

  • Define the name of the Data Layer Variable: To track items in your ecommerce store, enter a name that matches the identifier in your push data layer, for example "Ecommerce.items". Once you have your data layer variable ready, you can now proceed to create tags and triggers in GTM to facilitate the transfer of this data into GA4.

Step 5: Set up Google Analytics 4 for Ecommerce

  • Start the data flow: Go to "Admin", then "Property Settings", followed by "Data Collection and Editing" and finally "Data Flows". Select your data flow for the website from the list.

  • Enable the ecommerce features: Within the data flow settings, enable the 'Enhanced Measurement' option and make sure the 'Ecommerce' option is enabled.

  • Configure ecommerce events: Identify and specify events such as 'view_item', 'add_to_cart' and 'begin_checkout'. Navigate to the 'Events' section of Google Analytics 4 and mark these events as 'Conversions' if necessary.

Step 6: Set up Tags for Ecommerce Activities

  • Create tags for each event: create a new tag for each ecommerce related event.

  • Configure the tag: To set up a new Google Analytics 4 Ecommerce tag, select "Google Analytics: GA4 Configuration" and enter your Measurement ID, which is available in the Data Flows section of your GA4 property.

  • Trigger Implementation: Create triggers to activate these tags. For example, an "add_to_cart" event might use a trigger based on clicking the "Add to Cart" button, with the trigger set to "All Pages".

Step 7: Enabling Enhanced Ecommerce in GA4

  • Creating Tags for Each Ecommerce Interaction: For each ecommerce action, establish a new tag, such as 'GA4 Ecommerce'.

  • Choosing Tag Type: Select the 'GA4 Event' type.

  • Selecting the Configuration Tag: Utilize the previously set up 'GA4 Ecommerce | page view' tag.

  • Specifying Event Names: Enter a specific name for each event, such as 'add_to_cart', and create tags for various ecommerce interactions including view_item, add_to_cart, and begin_checkout.

  • Using Dynamic Variables: Consider using a variable that automatically identifies and sends the type of ecommerce activity to your event tag. This allows the use of a single tag to send multiple ecommerce events (e.g., 'add to cart', 'purchase') to GA4.

  • Adding Event Parameters: Include necessary parameters like 'currency', 'value', 'items', etc., with the option to create custom events as needed.

  • Enabling Ecommerce Data Sending: Go to 'More settings', activate the 'Send Ecommerce data' option, and ensure 'Data Layer' is selected for automatic capturing and sending of ecommerce data with your events to GA4.

  • Configuring Triggers: Set up triggers to activate these tags, for example, using a click on the 'Add to Cart' button as a trigger for 'add_to_cart'. Configure the trigger for Custom Events, enter the data layer event name, and use the ‘User Regex Matching’ option to treat underscores as part of regular expressions. This allows for the inclusion of Google's recommended ecommerce events, separated by underscores, in custom event names. Finally, save both the trigger and the tag.

Step 8: Verifying Tag Functionality

  • Preview Mode in GTM: Activate GTM's preview mode to evaluate your tags. Click on the "Preview" button in the Google Tag Manager dashboard's upper-right section. This launches the Preview mode, enabling you to examine tag activation on your website within a sandbox environment. Launch a new browser tab and navigate to your website. The Preview mode will present debugging information, illustrating which tags are activated and verifying their operational status. Additionally, the 'Debug view' in GA4 can be utilized to inspect report previews.

  • Confirmation in GA4: Ensure that events are properly logged in GA4's real-time report. Navigate to the "Reports" menu and select "Realtime" for up-to-the-minute data. Execute activities on your site that initiate the GTM events you've established (such as pressing a button or completing a purchase).

In the GA4 Real-Time report, these events should be recorded almost instantaneously. Confirm that the recorded events align with your setup intentions and that data is accurately transmitted from your site to GA4.

Conclusion

In conclusion, moving to Google Analytics 4 (GA4) and leveraging its capabilities for more advanced measurement represents a significant step forward for ecommerce companies towards leveraging data-driven insights. This guide has walked you through the key steps of setting up GA4 for your ecommerce platform, including configuring data flows, implementing a data layer, and creating tags for ecommerce events.

By leveraging GTM's tag management system along with GA4's advanced tracking features, you can uncover a deeper understanding of your customer journey. Remember, the digital landscape is constantly evolving and staying ahead requires a commitment to adapting and optimizing your analytics practices. GA4 is a platform that not only meets today's needs for tracking, but also paves the way for leveraging new technologies and analytics methodologies.

However, if you are still unsure how to set up Enhanced Ecommerce in GA4, feel free to contact us to schedule a free consultation. Our specialists will be happy to help you with this implementation.

FAQ

1. What is GA4?

GA4 is the latest version of Google Analytics with advanced features for tracking user interactions.

2. Why use GA4 for ecommerce?

GA4 offers better analysis of customer behavior and allows more detailed tracking of conversions and interactions.

3. How to get started with GA4?

Create a Google Analytics account, set up the GA4 property for your site and install the tracking code.

4. Is it necessary to use GTM along with GA4?

GTM is not required, but is often recommended for easier tracking code management.

5. What are the recommended events to track in GA4?

Track important ecommerce events such as product views, add to cart, purchases, and returns.

6. How to verify tracking functionality in GA4?

Use the preview mode in GTM and the real-time feature in GA4 to verify that events are being tracked correctly.

7. Can I track offline interactions in GA4?

Yes, GA4 allows you to send offline interaction data using the Measurement Protocol.