Connecting WooCommerce to GA4
WooCommerce keeps the order in your own database, which is both the advantage and the reason nobody has wired it properly. GA4 is where the business goes to understand what happened, which makes an unattributed conversion there expensive in decisions rather than in ad spend. The join between them succeeds or fails on one thing: whether the GA4 client_id reaches the WooCommerce order before the conversion happens, because GA4 can only match a conversion it can tie back to a click it recognizes.
Free30 minutesNo obligation
Specific to this pair
WooCommerce to GA4: purchase from the hook with the _ga client_id
Fire GA4's purchase from woocommerce_payment_complete through Measurement Protocol, with the client_id and session_id saved as order meta at creation, instead of the cacheable thank-you page. Turn off the plugin's browser purchase first, since GA4 will not deduplicate. Send refunds with the order number as transaction_id, and hook status changes for bank-transfer gateways.
The thank-you page is a poor place to fire GA4's purchase on WooCommerce: page caching can serve it without running the tag, and a customer who reloads it can send purchase twice. Fire from woocommerce_payment_complete through Measurement Protocol instead, with the client_id and session_id saved as order meta when the order is created. The client_id is the last two number groups of the _ga cookie; the session_id comes from the _ga_ cookie for your measurement ID, whose format has changed over time, so parse it defensively.
If a plugin such as Google for WooCommerce or GTM4WP already sends the browser purchase, turn that event off before switching to the server, or GA4 counts every order twice; it does not deduplicate Measurement Protocol against browser events. Keep the browser side for view_item, add_to_cart and begin_checkout, which need the page anyway.
Pin the status set before sending refunds. If processing counts as purchased, a refund issued from the order screen should send a refund event with the order number as transaction_id from the refund hook. Orders on bank transfer or cash on delivery may never call woocommerce_payment_complete; check how each of your gateways behaves and hook the status change for those.
WooCommerce → GA4 · what breaks
Why this join usually fails — WooCommerce → GA4
- 01
The GA4 client_id never reaches WooCommerce
WooCommerce sites are usually the most heavily plugged-in of any platform. Caching plugins serve a static page to the visitor, optimization plugins defer or strip scripts, and consent plugins block them entirely. Any of the three will stop an identifier being captured, and they fail silently.
- 02
Caching and optimization plugins eat the tracking
The page the customer sees is not the page your code assumed. This is the most common cause of WooCommerce tracking that worked at launch and silently stopped after a plugin update.
- 03
Everything lands under (direct)/(none)
The classic Measurement Protocol symptom, and it always means the same thing: the client_id was missing or wrong, so GA4 had no session to attach the event to and invented a new user.
- 04
Nothing reconciles afterwards
GA4 DebugView shows events arriving with their parameters, and Realtime confirms the user and session they attached to. Neither tells you whether you are double-counting — for that, compare GA4's conversion count against the source system's record for the same window.
WooCommerce → GA4 · the fix
What working looks like — WooCommerce → GA4
The GA4 client_id on every order
Conversions arriving in GA4
Conversions appear in GA4 attributed to the original session's source and medium, so acquisition reporting reflects what actually drove revenue.
Reconciled against the source
WooCommerce → GA4 · architecture
How WooCommerce and GA4 actually connect
- 1
WooCommerce holds the truth
You own the database, so the truth is exactly as good as the query you write against it. Pin the status set first — whether processing, completed, or both count as a conversion changes the number by a lot and is the source of most arguments.
- 2
GA4 needs a click to match
GA4 needs the client_id to attach a server event to the user and session that produced the click. Without it there is no attribution to inherit and the event is orphaned.
- 3
The identifier is the bridge
The GA4 client_id, captured at the visit and carried into the WooCommerce order.
- 4
The event source decides reliability
Fire server-side from the PHP hook rather than from the thank-you page template. Page caching means the thank-you page cannot be relied on to execute anything, and on many stores it is served from cache to a paying customer.
- 5
Deduplication at the destination
GA4 has no built-in deduplication for Measurement Protocol. If the browser also sends the event, it counts twice. The only reliable approach is to decide per event which side sends it, and enforce that decision — GA4 will not protect you from your own duplicates.
WooCommerce → GA4 · normal or broken
Working vs. broken, side by side — WooCommerce → GA4
Normal, not a fault
The GA4 client_id present on the order
Sent from the woocommerce_payment_complete hook
Deduplicated correctly
GA4 has no built-in deduplication for Measurement Protocol. If the browser also sends the event, it counts twice. The only reliable approach is to decide per event which side sends it, and enforce that decision — GA4 will not protect you from your own duplicates.
Reconciles with the source
Actually broken
The GA4 client_id missing on most records
WooCommerce sites are usually the most heavily plugged-in of any platform. Caching plugins serve a static page to the visitor, optimization plugins defer or strip scripts, and consent plugins block them entirely. Any of the three will stop an identifier being captured, and they fail silently.
Sent from the browser
The page the customer sees is not the page your code assumed. This is the most common cause of WooCommerce tracking that worked at launch and silently stopped after a plugin update.
Counted twice, or not at all
The classic Measurement Protocol symptom, and it always means the same thing: the client_id was missing or wrong, so GA4 had no session to attach the event to and invented a new user.
Nobody has reconciled it
WooCommerce → GA4 · diagnose
Diagnostic order — WooCommerce → GA4
- 01
Count orders carrying the GA4 client_id
- 02
Follow one real conversion end to end
- 03
Check order meta on ten recent orders
Directly in the database or with a meta viewer. Then disable page caching for the checkout path and see whether coverage changes — if it does, caching is your cause.
- 04
Check whether server events carry a session and a source
In GA4 Realtime or DebugView, find the event and look at its session and traffic source. A brand-new user with no source on every server event is the missing-client_id signature.
- 05
Read the match rate, not the success message
GA4 DebugView shows events arriving with their parameters, and Realtime confirms the user and session they attached to. Neither tells you whether you are double-counting — for that, compare GA4's conversion count against the source system's record for the same window.
WooCommerce → GA4 · prove
How it gets proven — WooCommerce → GA4
Source of truth
WooCommerce → Orders (or the wp_wc_order_stats table), for the same window and status set.
- The GA4 client_id confirmed present on a live order.
- Server events confirmed in DebugView attaching to an existing session with the original traffic source intact.
- Order meta confirmed present on orders placed while full page caching was active.
WooCommerce → GA4 · free audit
What we check in the free audit
- Count orders carrying the GA4 client_id
- Follow one real conversion end to end
- Check order meta on ten recent orders
- Check whether server events carry a session and a source
- Read the match rate, not the success message
Checked against
WooCommerce → Orders (or the wp_wc_order_stats table), for the same window and status set.
Free30 minutesNo obligation
WooCommerce → GA4 · when not to buy
When you don't need this — WooCommerce → GA4
- Measure identifier coverage yourself first — pull your last hundred orders and count how many carry the GA4 client_id.
- If you run a small store with no caching layer and a single free plugin already reporting accurately, leave it alone.
- GA4 is reporting, not bidding. If your problem is ad platform optimization, fix the ad platform destination first — GA4 will not change what any campaign does.
WooCommerce → GA4 · what we deliver
What gets built — WooCommerce → GA4
Identifier capture into WooCommerce
Capture the click identifier and persist it as order meta on the order object with a small snippet in the theme's functions or a purpose-built plugin. Order meta lives in your own database, so it survives caching, plugin conflicts and the customer's browser.
Event source: the woocommerce_payment_complete hook
Fire server-side from the PHP hook rather than from the thank-you page template. Page caching means the thank-you page cannot be relied on to execute anything, and on many stores it is served from cache to a paying customer.
Dispatch to GA4
Measurement Protocol events with the client_id, session_id and the correct measurement ID and API secret, sent server-side.
Reversals where they exist
The refund hooks carry the order ID, so reversals are straightforward once the identifier is on the order.
Written guarantee
95%+ tracking accuracy
Measured against WooCommerce → Orders (or the wp_wc_order_stats table), for the same window and status set.. Miss it and we keep working at no cost.
From $400 · See packages
FAQ
WooCommerce → GA4 questions, answered
Usually the cached thank-you page did not run the tag, or the customer never returned to it. Sending purchase from the payment-complete hook with the stored client_id fixes both.
Read the _ga cookie at checkout and save the client_id as order meta, along with the session ID. The server event then uses those stored values.
Almost always because the GA4 client_id never reached the WooCommerce order. WooCommerce sites are usually the most heavily plugged-in of any platform. Caching plugins serve a static page to the visitor, optimization plugins defer or strip scripts, and consent plugins block them entirely. Any of the three will stop an identifier being captured, and they fail silently. Measure coverage before debugging the dispatch.
The client_id, from the _ga cookie. Measurement Protocol events without it are rejected or create a brand-new user with no session and no source, which is how server events end up filed under (direct)/(none) and make paid channels look worse than they are. Send session_id alongside it so the event joins the existing session, and include engagement_time_msec or the event may not appear as expected in reports.
The woocommerce_payment_complete hook. Fire server-side from the PHP hook rather than from the thank-you page template. Page caching means the thank-you page cannot be relied on to execute anything, and on many stores it is served from cache to a paying customer.
GA4 DebugView shows events arriving with their parameters, and Realtime confirms the user and session they attached to. Neither tells you whether you are double-counting — for that, compare GA4's conversion count against the source system's record for the same window.
More on WooCommerce → GA4
- WooCommerce Subscriptions → GA4Connecting WooCommerce Subscriptions to GA4
- GA4 and WooCommerce mismatchWhy don't GA4 and WooCommerce revenue match?
- WooCommerce + GoogleGoogle Ads and GA4 tracking for WooCommerce
RELATED GUIDES
Where WooCommerce → GA4 fits in the rest of your tracking
- PrestaShop → GA4Connecting PrestaShop to GA4
- Ecwid → GA4Connecting Ecwid to GA4
- OpenCart → GA4Connecting OpenCart to GA4
- WooCommerce → PostHogConnecting WooCommerce to PostHog
- WooCommerce → AmplitudeConnecting WooCommerce to Amplitude
- Furniture ecommerceConversion tracking for furniture ecommerce, measured after delivery
- Magento → GA4Connecting Magento to GA4
- nopCommerce → GA4Connecting nopCommerce to GA4
Free · 30 min
Get WooCommerce and GA4 joined properly
Free30 minutesNo obligation
