← Back to Guides

WooCommerce Google Analytics 4 Setup: Complete Guide with Enhanced Ecommerce (2026)

WPBundle Team··13 min read
woocommerce google analytics 4woocommerce ga4 setupwoocommerce enhanced ecommercewoocommerce ga4 tracking

Setting up Google Analytics 4 for WooCommerce is no longer optional — Universal Analytics is gone, and GA4 is the only game in town. But GA4's ecommerce tracking works differently from UA, and the default WordPress plugin setup misses critical purchase events. This guide walks you through a complete, accurate GA4 implementation: from property creation to verified purchase tracking, with no lost revenue data.

TL;DR

Create a GA4 property, install via Google's official plugin or Google Tag Manager, enable Enhanced Ecommerce, verify purchase events in DebugView, then set up the key reports — revenue, acquisition, and product performance. Budget 2–4 hours for a clean first-time setup.

Why GA4 ecommerce tracking breaks on WooCommerce (and how to fix it)

GA4 replaced Universal Analytics in July 2023. Most WooCommerce stores migrated — but many are running broken tracking without knowing it. The most common failures:

  • Purchase events firing twice — once from the plugin, once from a leftover UA snippet
  • Revenue not matching WooCommerce orders because tax and shipping are excluded
  • Missing add_to_cart events because WooCommerce updates cart via AJAX without a page reload
  • Checkout steps not tracked because the plugin only fires begin_checkout, not all funnel steps
  • Conversions showing in GA4 but not in the Ecommerce reports — a configuration issue, not a data gap

Each of these is fixable. Start from scratch with this guide and you'll have reliable data within a day.

73%

of WooCommerce stores have at least one GA4 tracking error

2x

revenue inflation from double-firing purchase events

30%

of add_to_cart events missed with default plugin install

Step 1: Create your GA4 property

If you already have a GA4 property from the migration period, skip to Step 2. If you're starting fresh:

  1. Go to analytics.google.com and sign in with the Google account that owns your business.
  2. Click Admin (bottom left gear icon), then Create Property.
  3. Give it a name (e.g., “WPBundle Store”), set your time zone and currency. Currency matters — set it to match WooCommerce or revenue comparisons will be off.
  4. Choose Web as the platform and enter your store URL.
  5. Enable Enhanced measurement — this auto-tracks page views, scrolls, outbound clicks, and site search without extra code.
  6. Save your Measurement ID (format: G-XXXXXXXXXX). You'll need it in the next step.

Data retention default is 2 months

GA4 defaults to a 2-month data retention window. Go to Admin → Data Settings → Data Retention and change it to 14 months. Do this before you start collecting data — you can't retroactively extend it.

Step 2: Install the tracking code on WooCommerce

You have two solid options: the official Google plugin, or Google Tag Manager. GTM is more flexible but adds complexity. For most WooCommerce stores, the official plugin is the right starting point.

Option A: Google Site Kit (recommended for most stores)

Install the Google Site Kit plugin from the WordPress repository. Activate it, then run through the setup wizard:

  1. Connect your Google account.
  2. Verify site ownership (Site Kit handles this automatically via a DNS record or HTML file).
  3. Connect Google Analytics and select your GA4 property.
  4. Site Kit inserts the gtag.js snippet into your<head> automatically.

Site Kit does not handle WooCommerce ecommerce events out of the box. You'll add those separately in Step 3.

Option B: Google Tag Manager (for developers and multi-tag setups)

If you use GTM, install the GTM4WP plugin. Enter your GTM container ID (GTM-XXXXXXX). In GTM, create a GA4 Configuration tag and a GA4 Event tag for each ecommerce event. This approach gives you full control over what fires and when — but requires GTM familiarity.

Don't use both

Site Kit and GTM each add gtag.js to your page. Using both without careful configuration causes double-counted pageviews and events. Pick one method and stick with it.

Step 3: Enable WooCommerce ecommerce event tracking

GA4's ecommerce tracking relies on specific events: view_item, add_to_cart, begin_checkout, add_payment_info, and purchase. WooCommerce doesn't fire these automatically — you need a bridge.

Using WooCommerce Google Analytics Integration (free)

Install WooCommerce Google Analytics Integration from the official WooCommerce plugin. Go to WooCommerce → Settings → Integration → Google Analytics:

  • Paste your GA4 Measurement ID into the GA4 Tracking ID field
  • Enable "Purchase Tracking" to fire the purchase event on the thank-you page
  • Enable "Add to Cart Tracking" — this covers the AJAX add-to-cart gap
  • Enable "Remove from Cart Tracking" for full funnel visibility
  • Leave "Use Display Advertising Features" off unless you run Google Ads remarketing

Disable UA if still present

If you previously used this plugin for Universal Analytics, disable the old UA tracking ID field. Having both active causes double-counting. Also remove any hardcoded UA snippet (gtag('config', 'UA-XXXXX')) from your theme's functions.php.

Using GTM4WP for ecommerce (for GTM users)

GTM4WP has a built-in Data Layer option under Settings → Integration. Enable Track eCommerce and select GA4 Format. This pushes all WooCommerce events into the GTM data layer in GA4 format, which your GTM GA4 Event tags can then consume.

Step 4: Verify events with GA4 DebugView

Don't assume it's working — verify it. GA4's DebugView shows events in near real-time from your own browser session.

  1. Install the Google Analytics Debugger Chrome extension. Activate it.
  2. In GA4, go to Admin → DebugView. Your browser is now a debug device.
  3. On your store: view a product, add it to cart, proceed to checkout, and complete a test order (use a Stripe test card or set up a test payment gateway).
  4. In DebugView, confirm you see: page_view, view_item, add_to_cart, begin_checkout, add_payment_info, and purchase — each with correct revenue amounts.
If purchase fires but revenue shows as $0, check that your currency code in WooCommerce matches your GA4 property currency. A mismatch causes GA4 to drop the value silently.

Step 5: Configure conversions in GA4

By default, only purchase is marked as a conversion in GA4. Mark these additional events as conversions for a complete picture:

  • purchase — your primary conversion (already set by default in most properties)
  • generate_lead — if you have a free trial or waitlist form
  • sign_up — user registration for your store account
  • begin_checkout — a micro-conversion that helps identify checkout abandonment

Go to Admin → Events, find each event, and toggle Mark as conversion. Conversions appear in your Acquisition reports, showing which traffic sources drive actual sales.

Step 6: Set up the key GA4 ecommerce reports

GA4's default reports don't surface WooCommerce ecommerce data well. Navigate to Reports → Monetisation for the ecommerce section. The most useful reports for WooCommerce stores:

Ecommerce purchases report

Shows revenue, transactions, and units by item name. Use this to find your top-selling products and which products have high views but low purchase rates — a conversion problem worth investigating.

Funnel exploration (custom)

Go to Explore → Funnel exploration. Create steps: view_itemadd_to_cart begin_checkoutpurchase. This shows exactly where people drop out of your purchase funnel and quantifies the opportunity at each step.

User acquisition report

Reports → Acquisition → User acquisition. Shows which channels drive new customers (as opposed to sessions). For WooCommerce, new customer acquisition cost is often higher than repeat purchase revenue — track this separately from session-based acquisition.

Link Search Console for keyword data

Connect Google Search Console to GA4 under Admin → Product Links → Search Console. This surfaces organic search queries and landing pages alongside your revenue data — essential for WooCommerce SEO decisions.

Common GA4 WooCommerce problems and fixes

Revenue is inflated (double-counting)

Cause: two tracking tags both firing the purchase event. Check your page source for multiple gtag.js snippets. Fix: remove all hardcoded snippets from your theme and let only one plugin manage tracking.

Revenue doesn't match WooCommerce reports

Cause: GA4 fires on the thank-you page load, but WooCommerce clears the order data before the event fires for payment gateways with redirects (PayPal, Mollie). Fix: use server-side Measurement Protocol to send the purchase event from PHP after payment confirmation, not from the client-side page load.

Add-to-cart events missing for AJAX carts

Cause: clicking “Add to cart” on category/shop pages uses AJAX — no page load, no event. Fix: ensure your tracking plugin explicitly listens for the added_to_cart WooCommerce jQuery event. GTM4WP does this; the basic Site Kit + GA4 integration does not.

Checkout steps not tracked

Cause: WooCommerce's default checkout is a single page. GA4's checkout funnel assumes step progression. Fix: use the add_shipping_info and add_payment_info events, which fire when the customer fills in shipping details and selects a payment method — these are separate GA4 events, not UA checkout steps.

GA4 for headless WooCommerce

If you're running a headless WooCommerce setup with a Next.js frontend, the plugin approach above doesn't apply — your frontend is decoupled from WordPress. Instead:

  • Use the gtag.js snippet directly in your Next.js layout (or next/script with strategy="afterInteractive")
  • Fire GA4 ecommerce events manually from your cart and checkout components using the gtag() function
  • Use GA4's Measurement Protocol for server-confirmed purchases — fire the purchase event from your Next.js API route after WooCommerce confirms payment
  • For purchase event accuracy, always send from server-side after webhook confirmation, not from client-side on thank-you page load

This approach gives you more accurate tracking than the plugin method — you control exactly when and what fires. See our WooCommerce webhooks guide for Next.js for the server-side event pattern.

Headless WooCommerce GA4 implementation is cleaner than WordPress plugin-based tracking — but requires writing the event calls yourself. The payoff: no double-counting, no AJAX gaps, and Measurement Protocol accuracy for purchases.

GA4 reporting checklist for WooCommerce

  • Data retention set to 14 months (not the 2-month default)
  • DebugView confirmed: all 5 ecommerce events firing with correct values
  • Currency in GA4 matches WooCommerce currency
  • Purchase event not double-firing (check DebugView for duplicate purchase events)
  • Conversions configured: purchase, begin_checkout
  • Search Console linked for keyword + revenue data
  • Funnel exploration built for view_item → add_to_cart → checkout → purchase
  • Timezone matches your WooCommerce store timezone

What GA4 won't tell you about your WooCommerce profits

GA4 tracks revenue — what customers pay. It doesn't track what you keep. Your actual profit picture requires knowing your product costs, shipping spend, payment gateway fees, and refunds.

For that layer, see our guides on tracking profit in WooCommerce and tracking Stripe fees against orders. GA4 answers the marketing question; those guides answer the business health question.

Summary

A clean GA4 WooCommerce setup takes a few hours but pays dividends for years. The key steps: create your property with the right currency and timezone, use a single tracking method (plugin or GTM — not both), verify every ecommerce event in DebugView before trusting the reports, and set up the funnel exploration report to find your biggest drop-off point. Then check it weekly, not daily — GA4 is for trends and decisions, not for real-time order monitoring (your WooCommerce dashboard does that better).

See the numbers that actually matter.

WPBundle's profit tracker shows real profit after fees, COGS, and shipping — not just revenue. Included in the $149 bundle.

Join the Waitlist

Track real profit, not just revenue — included in WPBundle