Post

WooCommerce GTM Ecommerce Tracking

Set up enhanced ecommerce tracking in Google Tag Manager for WooCommerce using the gtm4wp plugin.

Overview

Track standard ecommerce events (add to cart, checkout, purchase etc) in GA4 via Google Tag Manager using the free gtm4wp plugin.

Prerequisites:

  • GTM installed on your site
  • Google Tag created in GTM connected to your GA4 property
  • WooCommerce installed

See GTM Cheatsheet for setting up the Google Tag.

Install the Plugin

  • Install and activate GTM4WP from the WordPress plugin directory
  • Go to plugin settings and enable WooCommerce tracking

Download the Predefined Container

The plugin provides a pre-built GTM container with all ecommerce events already configured.

Import the Container into GTM

  • In GTM create a new workspace (same account — a separate workspace keeps the import clean)
  • Go to Admin → Import Container
  • Select the downloaded file
  • Choose your new workspace
  • Select Merge (not Overwrite)

Update the Measurement ID

  • Go to Tags in the new workspace
  • Find the ecommerce event tag
  • Update the Measurement ID to match your GA4 property (format: G-XXXXXXXXXX)

Submit and Test

  • Submit the workspace
  • Browse your store — add items to cart, go through checkout, complete a purchase
  • Check GA4 → Reports → Realtime for the following events:
1
2
3
4
5
6
7
8
9
10
view_item
view_item_list
select_item
add_to_cart
remove_from_cart
view_cart
begin_checkout
add_payment_info
add_shipping_info
purchase

Once confirmed, mark purchase as a key event in GA4 → Admin → Events.

This post is licensed under CC BY 4.0 by the author.