Home/Insights/Tracking & analytics

WooCommerce GA4 e-commerce tracking with Google Tag Manager

MNBy Madlin Nabil, Senior WordPress Developer & MarTech Specialist··3 min read

If your WooCommerce reports in GA4 show sales that don’t match your orders, the problem is almost always the setup, not GA4. This guide shows how to track the full e-commerce funnel with Google Tag Manager, and how to check that every event fires once, with the right value.

In short
  • Use one tag manager container and one GA4 configuration. Never load GA4 from two plugins.
  • Track the funnel: view_item, add_to_cart, begin_checkout, add_payment_info, purchase.
  • Every event needs value, currency and an items array, or GA4 revenue reports stay empty.
  • Test in GTM Preview and GA4 DebugView before you trust any number.

Step 1: Decide where the data layer comes from

WooCommerce doesn’t send e-commerce events to Google Tag Manager by itself. You need something that pushes product and order data into the dataLayer. The common choice is the GTM4WP plugin, which adds the container and the e-commerce data layer. Some stores use Google’s Site Kit instead, but if you use both, you will usually get the container twice.

Rule: pick one source for the container and turn the other one off.

Step 2: Create the GA4 tags in GTM

  1. Add a Google tag with your GA4 measurement ID, firing on all pages.
  2. Create a GA4 Event tag that uses the event name from the data layer ({{Event}}) and turn on “Send e-commerce data” from the data layer.
  3. Create a Custom Event trigger matching the e-commerce events: view_item|view_item_list|add_to_cart|remove_from_cart|view_cart|begin_checkout|add_shipping_info|add_payment_info|purchase (with “Use regex matching” on).
  4. Publish the container only after testing (Step 4).

Step 3: Mark purchase as a key event

In GA4, open Admin → Events and make sure purchase is marked as a key event (conversion). If you import conversions into Google Ads, import the GA4 purchase, or use the Google Ads conversion tag, but not both for the same sale.

Step 4: Test like a customer

  1. Open GTM Preview and visit a product page. You should see view_item once.
  2. Add to cart, go to checkout, and place a real test order (cash on delivery works well for testing).
  3. In GA4 DebugView, open the purchase event and check transaction_id, value, currency and the items.
  4. Reload the thank-you page. A second purchase must not appear. If it does, your revenue will be counted twice.

Common mistakes I see on WooCommerce stores

  • Two containers or two GA4 tags. Page views and events double. Check the page source for two GTM- IDs or two gtag/js scripts.
  • Wrong currency. EGP orders sent as USD make revenue reports useless.
  • Value includes shipping in one place and not another. Decide once and keep it the same in GA4 and in ads platforms.
  • Thank-you page reload. Without a check on the order ID, every reload sends a new purchase.
  • Payment gateways that redirect. Customers who pay on an external page sometimes don’t return to the thank-you page, so the purchase event never fires. Compare GA4 purchases with real orders every month.

A simple monthly check

Compare the number of orders in WooCommerce with GA4 purchases for the same month. A small gap is normal (ad blockers, consent). A gap above 15–20% means something in the setup needs fixing.

FAQ

Do I need a plugin to connect WooCommerce with GA4?

You need something that sends order and product data to the data layer. A plugin like GTM4WP is the simplest way. Hard-coding is possible, but harder to maintain when the theme or checkout changes.

Why does GA4 show fewer purchases than WooCommerce?

Ad blockers, cookie consent, customers who don’t return from the payment page, and cash-on-delivery orders that are later cancelled. Check the gateway return flow first, because it is the one you can fix.

Can I use GA4 and Meta Pixel from the same GTM container?

Yes. That is the cleanest setup: one container, one data layer, and separate tags for GA4 and Meta that use the same events.

Related insights

See all 23 articles →

Need this for your store?

I build and fix WordPress and WooCommerce sites with marketing in mind: tracking, speed, checkout and integrations.