WooCommerce Ga4: Add to Cart Enhanced Ecommerce Event using GTM and DataLayer (Part 3/5)

by ShahzadaAliHassan - 4th March 2024


In the world of e-commerce, understanding customer behavior is crucial for success. One of the key actions that e-commerce managers need to track is the "Add to Cart" event. This post will guide you through configuring Google Analytics to track these events using Google Tag Manager for a WooCommerce store. This process is essential for anyone looking to optimize their online store and gain detailed insights into how users interact with their products.

Why Track "Add to Cart" Events?

Tracking "Add to Cart" events provides valuable data about which products attract the most interest and are likely to be purchased. This action is a strong indicator of buying intent. By analyzing this data, store owners can optimize their product placements and promotions to maximize conversions. Furthermore, detailed reports from tools like Google Looker Studio and Google Analytics can show the journey from product views to purchases, helping you fine-tune your marketing strategies.

Setting Up Google Tag Manager

Before diving into the configuration of "Add to Cart" events, make sure that your Google Tag Manager (GTM) container is properly set up on your WooCommerce store. If you haven’t done this yet, refer to the initial video in our series where we cover the setup process.

Data Layer Configuration

The data layer plays a critical role in how GTM interacts with your website. It acts as a repository of all the data that you want to pass to Google Analytics. For "Add to Cart" events, when a user clicks the add button, this triggers a data layer push event containing product details such as item ID, name, price, and quantity.

Creating Tags and Triggers

  1. Tag Creation: In GTM, create a new tag specifically for the "Add to Cart" event. This tag will be responsible for sending the captured data to Google Analytics.
  2. Trigger Setup: Set up a trigger that activates when the "Add to Cart" event occurs. This involves configuring a custom event trigger that matches the event name in the data layer.

Configuring the Tag in GTM

For the tag, you’ll need your Google Analytics Measurement ID, which can be found in your GA account. In the tag configuration, use the event name add_to_cart, adhering to the naming convention that avoids spaces and uses underscores instead.

Testing and Publishing

After setting up your tags and triggers, use GTM’s preview mode to test the configuration on your website. This mode allows you to see in real-time how tags are firing as you simulate navigating and adding products to the cart. Ensure that the "Add to Cart" event correctly sends all necessary data back to GA.

Once you confirm everything is working as expected, publish the GTM container to make the changes live. It’s crucial to regularly check the data in Google Analytics to ensure accuracy and to make any necessary adjustments.


Setting up "Add to Cart" tracking using Google Tag Manager and Google Analytics is a powerful way to gain insights into user behavior on your WooCommerce store. By following the steps outlined in this tutorial, you can start collecting valuable data that will help you understand your customers better and improve your store’s performance. Remember, each element of your e-commerce strategy benefits from data-driven decision making, and it starts with effective tracking setup.

Other Related Blogs

Cover Letter update - Nov 2022

We have decided to test a few more things in this month of November regarding cover letters. The first change is that we are not going to send the turnaround time and budget of the project inside the cover letter.

A Comprehensive Guide on Begin Checkout Remarketing Tracking on Google Ads and Shopify

In this guide, we explore the process of setting up a remarketing tag for the 'begin_checkout' event in Google Ads, using a data layer script on your Shopify store. We'll walk through creating a conversion action in Google Ads and configuring the remarketing conversion tag in your Google Tag Manager container. Before we start, ensure that your Google Tag Manager container is correctly firing on all pages of your Shopify store.

Custom Report for facebook ads in GA4

To track the traffic acquisition for Facebook ads on GA4 for iOS14+ users using custom reports in google analytics 4.

Google Ads Purchase Event Conversion Tracking on Shopify using Google Tag Manager

In today’s video, we're diving deep into setting up e-commerce Purchase conversion tracking using Google Ads and Google Tag Manager (GTM) on your Shopify store! 🛒💻 From adding GTM container snippets to your Shopify theme to creating custom conversion actions in Google Ads, we've covered it all. We begin by ensuring our GTM container is properly firing across Shopify pages, including the crucial 'Thank You' page. Then, we move on to the nitty-gritty of configuring conversion tracking in your Google Ads account and setting up the necessary data layers for tracking purchase events. Whether you're a seasoned pro or just starting out, this step-by-step guide is designed to help you optimize your e-commerce tracking for better performance and insights.