Set Up ECommerce Events in GTM for Your WooCommerce Shop

GTM is an exceptional tool that helps you capture information from your e-commerce website and send it to GA4.

With GTM you can send any information to GA4 through events and event parameters.

Example: When a person adds a product to the cart, you can send that information as an event “add_to_cart” in GA4. Along with it, you can send the product name, value, SKU, item category, brand, variant, quantity, and more.

If you’ve followed my series of posts to set up a simple WooCommerce performance dashboard, you’ll now need to set up your GTM to be able to send that data to Google Analytics.

Quick Recap on How the Tracking Works

ecommerce tracking working gtm ga4 looker
  1. USER ACTIVITY ON WEBSITE: The user engages with your website (e.g., adds a product to a cart or makes a purchase).
  2. INFO SENT TO DATA LAYER: The website sends that information to a bucket (Data layer) which can be read by GTM.
  3. GTM READS DATA LAYER: GTM reads info from the Data Layer including variables and events you’ve set in GTM.
  4. GTM SENDS DATA TO GA4: GTM sends info using GA4: Event tag to GA4 based on triggers set by you.
  5. LOOKER STUDIO IMPORTS GA4 DATA: GA4 is connected with Looker Studio and imports all event data. These can then be used in reports.
  6. DASHBOARDS AND REPORTS: Using your event data and parameters, you can create dashboards and reports.

In this post, we’re going to work with points 3 & 4. We’ll teach GTM what information to pick from the data layer and set it up so it sends the required data to GA4.

Recommended ECommerce Events

Google recommends a few e-commerce events, and implementing those can help most of your tracking setup.

EventTriggerWhat the event is
add_payment_infoEnters their payment information on the checkout page.This event tracks when users submit their payment details during checkout. For example, entering credit card details or selecting a payment method like PayPal or UPI. This is crucial for tracking how many users proceed to payment, helping identify drop-offs in the checkout funnel.
add_shipping_infoClick the “Proceed to Checkout” button in the shopping cart.Tracks when users provide their shipping address or choose a delivery method during checkout. For example, filling out fields like name, address, and zip code or choosing “Standard Shipping” or “Express Delivery.” Helps understand shipping preferences and conversion behavior.
add_to_cartClicks the “Add to Cart” button on a product page.This event tracks when users add an item to their shopping cart. For example, a user clicks “Add to Cart” on a product detail page for a smartphone or a pair of shoes. Essential for monitoring product engagement and interest.
add_to_wishlistSaves an item to their wishlist for later purchase.Tracks when users save an item to their wishlist instead of adding it directly to the cart. For example, a user clicks “Save for Later” or “Add to Wishlist” on a premium product. Useful for understanding user intent and demand for specific products.
begin_checkoutHas their money been refunded for a previous purchaseTracks when users start the checkout process after reviewing their cart. For example, clicking “Checkout” after finalizing the items in their cart. Indicates strong purchase intent and is a key step in the conversion journey.
purchaseCompletes their order and reaches the confirmation page.Tracks when users successfully place an order. For example, a user sees the “Thank You” page after completing payment. This event captures the end goal of eCommerce—successful transactions—and is critical for revenue analysis.
refundHas their money been refunded for a previous purchase?Has their money been refunded for a previous purchase?
remove_from_cartRemoves an item from their shopping cart.Tracks when users delete an item from their cart. For example, clicking the “Remove” or “Delete” button next to a product in the cart. This helps identify reasons for abandonment and optimize the cart experience.
select_itemClicks on a specific product from a list or catalog.Tracks when users select an item from a list of offerings. For example, clicking on a product displayed in search results, a category page, or a “Trending Now” section. Useful for analyzing which products drive clicks and interest.
select_promotionClicks on a promotion or ad on the website.Tracks when users engage with promotional content. For example, clicking on a homepage banner advertising a “Buy 1 Get 1 Free” offer. This helps measure the effectiveness of promotions and ad placements.
view_cartVisits their shopping cart to review selected items.Tracks when users open their shopping cart. For example, clicking the cart icon to review items before proceeding to checkout. Helps gauge cart engagement and analyze drop-offs from this point.
view_itemOpens a product detail page to learn more about the item.Tracks when users view detailed information about a product. For example, clicking on a product in the catalog to see its price, description, and images. This event helps analyze product-level engagement.
view_item_listBrowse a collection of products or search results.Tracks when users view a list of products. For example, visiting a category page like “Men’s Shoes” or viewing results for “smartphones under ₹20,000.” This provides insights into browsing patterns and product discovery.
view_promotionSees a promotional banner, ad, or offer on the website.Tracks when users are exposed to promotional content. For example, a user sees a banner at the top of the homepage advertising a limited-time sale. Useful for evaluating the reach of promotions.

Now back to how the event tracking works:

  • The website sends the events mentioned above to the data layer.
  • GTM picks it up.
  • GTM sends this information to Google Analytics.

Now if you’re okay with using the recommended events from Google, the setup will be fairly easy, You can skip the section below if you want to directly jump into the setup.

If you want to send additional events and event information (parameters), then you’ll need to set up custom events and learn how the tag manager works.

How Does Google Tag Manager Work?

These three elements of GTM make it possible to send e-commerce data from your website to GA4:

  1. Data Layer Variables
  2. Tags
  3. Triggers

Read this post to learn how custom event tracking works through tags, triggers, and data layer variables in GTM.

2 Ways to Send E-Commerce Data

There are two ways to send e-commerce data from GTM to GA4:

  1. Using the send e-commerce data option in GA4: Event tag configuration
  2. Creating data layer variables and passing those as event parameters in the tag.

Since we’re using the recommended data layer code for e-commerce events, we can easily do the first.

image 1

If you are sending custom parameters that have different variable names and differ from the recommended e-commerce object, you can use the second option.

Setting up GA4 Events in GTM for your WooCommerce Shop

In this section, we’ll set up all the above e-commerce events in GTM. After you’re done with this setup, your GTM account should look like this:

ecommerce events gtm view

Here’s an overview:

  • We’ll set up custom events as triggers to let GTM know when to send the events to GA4.
  • We’ll also set up a constant – GA4 measurement ID, so we don’t have to enter it repeatedly when we’re setting up events.
  • We’ll set up GA4: event tag, with the same event name as pushed to the data layer, along with the send e-commerce data option turned on.

Setting up the constant – GA4 ID

Setting up a constant helps in better tag management. This enables us to use this value repeatedly without having to type it again. We’ll define the value of constant as our GA4 measurement ID so that we can use it when creating new GA4 Event tags.

Go to Variables from the left sidebar. Select New.

create variable gtm new

Name your Variable, I named mine as GA4 ID.

Click the variable configuration and from the list, select Constant as the option.

constant variable type gtm

Enter your GA4 measurement and click save. We’ll now use this variable while setting up our e-commerce events in Googe Tag Manager.

ga4 id constant gtm variable

Setting up the begin_checkout GA4 Event Tag

Let’s set up the begin_checkout tag.

  • Go to tags from the left sidebar on your GTM account workspace, and click on new.
gtm new tag first time
  • Name your tag. I’ve used Event – begin_checkout.
event name begin checkout tag gtm
  • Click on the tag configuration. Select Google Analytics, and then select Google Analytics: GA4 Event.
tag type google analytics gtm
ga4 event tag gtm
  • In the measurement ID, click on the plus icon,
measurement id plus gtm ga4 event
  • Select GA4 ID from the list. This is the constant that we created earlier.
ga4 id constant selection measurement id
gogole tag found container gtm
  • In the Event name – use the event name that you would like to see in your reports.
  • Since we’re using the Google recommended events, the event name here should be begin_checkout.
event begin checkout gtm
  • Expand more settings, and expand e-commerce. Tick the “Send Ecommerce data” section. Keep the data source as the Data Layer.
send ecommerce data gtm
  • Now let’s set up the trigger. Scroll down to the trigger section. Click on Choose a trigger.
choose trigger gtm
  • From the section that appears, Select “New Trigger” visible as a plus sign from the top right screen.
new trigger button gtm
  • Name your trigger. I’ve named mine as Trigger – begin_checkout. Click on the trigger configuration to select the type of trigger.
name trigger gtm
  • From the trigger type list, select a custom event as your trigger.
trigger type custom event list
  • When the trigger type is selected, you’ll see the event name field – type in the event name that you want as your GA4 tag trigger. Because the event name In our data layer comes as begin_checkout. we’ll name it so. Click on save.
trigger event name custom begin checkout
  • After you hit save, you’ll see your tag configuration at a glance. Make sure it matches the image below. Click on save again to save the tag.
begin checkout ga4 gtm event tag
  • Now that you’ve saved the tag, you should be able to see the tag in the list on your account.
begin checkout tag list gtm
  • Remember to submit the workspace for making your tag live. Alternatively, you can create all tags and triggers and then do a final submit.

Setting up other GA4 Event tags

Use the steps from above, you can set up other tags as well.

Let’s go over another event in short – add_to_whislisht :

  • Go to tags from the left sidebar on your GTM account workspace, and click on new.
  • Name your tag. I’ve used Event – add_to_wishlist.
  • Click on the tag configuration. Select Google Analytics, and then select Google Analytics: GA4 Event.
  • In the measurement ID, click on the plus icon and select GA4 ID from the list. This is the constant that we created earlier.
  • Event name – Since we’re using the Google recommended events, the event name here should be add_to_wishlist.
  • Expand more settings, and expand e-commerce. Tick the “Send Ecommerce data” section. Keep the data source as the Data Layer.
  • Now let’s set up the trigger. Scroll down to the trigger section. Click on Choose a trigger.
  • From the section that appears, Select “New Trigger” visible as a plus sign from the top right screen.
  • Name your trigger. I’ve named mine as Trigger – add_to_wishlist. Click on the trigger configuration to select the type of trigger.
  • From the trigger type list, select a custom event as your trigger.
  • When the trigger type is selected, you’ll see the event name field – type in the event name that you want as your GA4 tag trigger. Because the event name In our data layer comes as add_to_wishlist. we’ll name it so. Click on save.
  • After you hit save, you’ll see your tag configuration at a glance. Make sure it matches the image below. Click on save again to save the tag.
  • Now that you’ve saved the tag, you should be able to see the tag in the list on your account.
  • Remember to submit the workspace for making your tag live

You can set up other events in the same manner:

  • add_payment_info
  • add_shipping_info
  • add_to_cart
  • purchase
  • refund
  • remove_from_cart
  • select_item
  • select_promotion
  • view_cart
  • view_item
  • view_item_list
  • view_promotion

Test if your GA4 Event Tags Fire in GTM

Use GTM preview mode, go to your Google Tag Manager account and select Preview.

gtm preview button

In the tag assistant tab that opens up, enter your website (the one where you’ve connected that GTM account). Click on Connect.

tag assistant preview window

After you hit connect, you’ll either see a new window that opens your website or a new tab.

tag assistant connection success

Tip: Make sure your adblockers are off. Sometimes VPN or other extensions also block ads and tracking scripts, so make sure to allow them to see the connection.

Now click continue, and head over to the tab where your website is open.

Do a few actions on your site, such as adding a product to the cart.

product add to cart ddfarms

Head back over to the tag assistant tab. In the left sidebar, you should see the event “add_to_cart“. Click on the data layer tab to inspect the data layer values.

data layer add to cart event

If you scroll, you will also be able to find:

  • event: "add_to_cart"
data layer add to cart event info

This means that we’re getting add_to_cart as an event in the data layer and being it in the sidebar means that GTM has also identified it as an event.

Now let’s see if the tag was being fired or not (if GTM has sent the event add_to_cart to Google Analytics or not).

For this, go to the Tags tab, from here, you should be able to see Event – add_to_cart tag being fired.

event tag firing check ga4 gtm

Test if Your Events are Being Received by Google Analytics

Follow the steps same as above – use GTM preview mode to see if the tags are being fired.

From your Google Analytics property, go to Admin.

In admin, go to Debugview.

ga4 debug view add to cart

You should be able to see events from your device. Click on the event to get more details such as items and item attributes. This would confirm that you’re able to see your data in GA4.

Next Steps

Previous in the series: Enable WooCommerce Store to Push ECommerce Events to the Data Layer

Next: How Does Custom Event Tracking in GTM Work?

Also Read: Tracking WooCommerce Shop Performance using GA4, GTM and eCommerce Events

Siddharth
Siddharth

Siddharth is an SEO. He started his journey in digital marketing with a small blog which served as a playground for him to learn. The blogs allowed him to strategize and see the results to fruition. He has completed projects as an SEO consultant for several startups. He has an MBA from Delhi School of Business (Marketing & Finance). In his free time, he likes to meet his friends ‘Offline’.

Articles: 21

Leave a Reply

Your email address will not be published. Required fields are marked *