WooCommerce conversion tracking in GA4 comes down to one event done properly: a purchase event, fired once per order, carrying the order number as transaction_id, the value, the currency and the items. Everything else, from add-to-cart reports to Google Ads bidding, depends on that event being right. You can send it with Woo's free Google Analytics extension, with Google Tag Manager and a dataLayer, or both together if you are careless, which is how most stores end up with double-counted revenue. This guide covers what to send, how to send it, the block checkout differences, Google Ads, consent mode, and how to test before Black Friday rather than after it.
What WooCommerce conversion tracking should record
GA4 has a fixed set of recommended ecommerce events. A store needs, at minimum, view_item, add_to_cart, begin_checkout and purchase. Only the last one counts money, so it deserves the most care. These are the parameters Google's GA4 events reference defines for purchase:
| Parameter | Required | What to send from WooCommerce |
|---|---|---|
transaction_id |
Yes | The order number, unique per order. This is what lets GA4 discard duplicates. |
value |
Effectively yes | The sum of price times quantity for the items. Google's reference says not to include shipping or tax here. |
currency |
Yes, whenever value is set | The order's three-letter ISO currency, taken from the order, not the store default, if you sell in more than one currency. |
tax, shipping, coupon |
No | Sent as separate parameters, so revenue reports are not inflated by them. |
items |
Yes | One entry per line item, each with item_id or item_name, plus price and quantity. Use the same ID you use in your product feed. |
Then, in GA4, make sure purchase is marked as a key event (Admin, then Key events). Google renamed GA4 "conversions" to "key events"; the word "conversion" now means an action Google Ads uses for bidding. That naming change explains a lot of confused forum threads.
Three ways to send WooCommerce purchases to GA4
1. The Google Analytics for WooCommerce extension
Woo's free extension adds the Google tag and sends the standard ecommerce events. You paste your G- measurement ID under WooCommerce, Settings, Integration, Google Analytics, and tick the events you want. It is the right choice for a store that only needs GA4 and has no other tags to manage.
Read its documentation before relying on it, because two lines matter. Purchase tracking needs a payment gateway that returns the customer to the order received page. And page views are not tracked for logged-in admin users, so test orders placed while you are logged in will not show.
2. Google Tag Manager with a dataLayer
If you also run Google Ads, Meta, Microsoft Ads or anything else, GTM is easier to live with: WooCommerce pushes order data into the dataLayer once, and every tag reads from it. This is how we set up stores that advertise. Many plugins can build the dataLayer for you; if you want to understand or own it, here is the core of a purchase push, as a small plugin:
<?php
/**
* Plugin Name: GA4 purchase dataLayer
* Pushes one GA4 purchase event per order on the order received page.
*/
add_action( 'woocommerce_thankyou', 'mg_ga4_purchase_datalayer', 20 );
function mg_ga4_purchase_datalayer( $order_id ) {
// Never send from staging or local copies of the store.
if ( 'production' !== wp_get_environment_type() ) {
return;
}
$order = wc_get_order( $order_id );
if ( ! $order || $order->has_status( array( 'failed', 'cancelled' ) ) ) {
return;
}
// A reload or a revisit of this page must not count a second sale.
if ( $order->get_meta( '_mg_ga4_purchase_sent' ) ) {
return;
}
$items = array();
$value = 0;
foreach ( $order->get_items() as $item ) {
$product = $item->get_product();
$qty = $item->get_quantity();
$line = (float) $item->get_total(); // After discounts, before tax.
$value += $line;
$items[] = array(
'item_id' => ( $product && $product->get_sku() ) ? $product->get_sku() : (string) $item->get_product_id(),
'item_name' => $item->get_name(),
'price' => $qty ? round( $line / $qty, 2 ) : 0,
'quantity' => $qty,
);
}
$data = array(
'event' => 'purchase',
'ecommerce' => array(
'transaction_id' => (string) $order->get_order_number(),
'value' => round( $value, 2 ), // Items only: no tax, no shipping.
'tax' => (float) $order->get_total_tax(),
'shipping' => (float) $order->get_shipping_total(),
'currency' => $order->get_currency(),
'items' => $items,
),
);
// Order meta through the order object works with HPOS and legacy storage.
$order->update_meta_data( '_mg_ga4_purchase_sent', time() );
$order->save();
echo '<script>window.dataLayer = window.dataLayer || [];'
. 'window.dataLayer.push({ ecommerce: null });' // Clear the previous ecommerce object.
. 'window.dataLayer.push(' . wp_json_encode( $data ) . ');</script>';
}
In GTM, create a GA4 Event tag with the event name purchase, tick "Send Ecommerce data" with the data source set to Data Layer, and trigger it on a Custom Event named purchase. The ecommerce: null push comes straight from Google's GTM ecommerce guide; it stops values from an earlier event leaking into this one.
Two honest limitations of this approach. The order is marked as sent when the page is generated, so if the visitor's browser blocks the tag, that order is never sent. And if your full-page cache stores the order received page, nothing on it is reliable; that page must be excluded from caching.
3. Server-side events as a supplement
Some gateways, bank transfers and phone orders never put the customer on your thank-you page in a normal way. GA4's Measurement Protocol lets your server send events directly, keyed to the visitor's GA client ID. Google is clear that it is meant to augment browser tagging, not replace it, and if browser and server both send the same purchase, they must use the same transaction_id. Treat this as a second phase, not the starting point.
Block checkout vs classic checkout
Since WooCommerce 8.3, new stores on block themes get the Checkout block by default, and it changes what tracking code can hook into. We cover the wider trade-offs in our post on block versus classic checkout; for tracking, three differences matter:
- The classic jQuery events are gone. The classic checkout script fires events such as
updated_checkoutandcheckout_place_orderon the old checkout form, and many GTM recipes foradd_shipping_infoandadd_payment_infolisten for them. The Checkout block is a separate React application that places orders through the Store API, so those events never fire. The tags do not error; they simply stop recording. - The thank-you hook moved inside a block. On a block theme, the order confirmation page is a template made of blocks, and WooCommerce runs the
woocommerce_thankyouhook from inside its "Additional information" block. Remove that block while redesigning the page, and any purchase tracking attached to that hook stops, without a warning. - Purchase is still safest on the order received page. Both checkouts end on the same order received endpoint, which is why we fire
purchasethere, server-rendered from the order, rather than from checkout clicks.
If your checkout steps funnel in GA4 went flat the week someone switched to the block checkout, this is almost certainly why. Rebuilding those events against the block checkout, or moving a store's tracking onto a clean dataLayer, is routine work for our WooCommerce development team.
WooCommerce Google Ads conversion tracking: import or native tag
There are two ways to give Google Ads your sales, and you should pick one as the primary source.
Import the GA4 key event. Link GA4 to Google Ads, turn on auto-tagging, and create a Google Ads conversion from your GA4 purchase key event. One tag, one definition of a sale, the same numbers in both tools. The catch, per Google's own help page: you will not see view-through conversions, because those need native Google Ads conversion measurement.
Use the native Google Ads conversion tag. A Google Ads conversion tag firing on the same dataLayer event, sending the same value, currency and order number as its transaction ID. Google Ads uses that ID to drop duplicate conversions. It is the better fit for heavy Ads spenders who want enhanced conversions, which send hashed customer details from the order, and view-through data.
Whichever you choose, check Google Ads, Goals, Conversions. If both an imported GA4 purchase and a native purchase tag are set as primary, every sale is counted twice for bidding. Google marks GA4-based conversions as secondary when an account already has goals from an Analytics property for exactly this reason. Make one primary and leave the other as secondary for observation, or remove it.
Consent mode v2 and why your numbers dropped
If you sell to visitors in the European Economic Area, the UK or Switzerland, Google's EU user consent policy requires you to obtain their consent, and consent mode is how your tags learn the answer. "Version 2" added two signals to the original ad_storage and analytics_storage: ad_user_data (consent to send user data to Google for advertising) and ad_personalization (consent to personalized ads). When ad_user_data is denied, enhanced conversions cannot use hashed customer data.
Google describes two ways to run it in its consent mode overview:
- Basic: Google tags do not load at all until the visitor answers the banner. Nothing is sent for visitors who decline.
- Advanced: tags load with consent denied by default and send cookieless pings until the visitor agrees, which lets Google model some of the missing conversions.
Woo's Google Analytics extension does not include a banner; it works with consent management plugins through the WP Consent API. In practice this means your GA4 purchase count will be lower than your WooCommerce order count once consent is in place. That is expected. What is not expected is a banner that never updates consent, so even visitors who click "accept" are not tracked. Test that specifically.
The mistakes that break WooCommerce conversion tracking
- Duplicate purchases on reload. Customers refresh the thank-you page, bookmark it, or return to it from the order email. GA4 deduplicates purchases with the same transaction ID on web streams, according to Google's deduplication guide, but only if every copy carries the same real ID. Guard against it in code anyway, as the snippet above does, because Google Ads and other ad platforms see the duplicates too.
- Empty or fixed transaction IDs. The same guide warns that GA4 deduplicates every purchase sent with an empty
transaction_id. A tag with a broken variable can turn a month of sales into one. - Two senders. The Woo extension, a GTM tag and another tracking plugin all sending
purchaseat once. Pick one sender per event. - Missing currency, or the wrong value. Value without currency breaks revenue metrics. Value including shipping and tax inflates revenue against Google's own definition and makes return on ad spend look better than it is.
- A newsletter signup counted as a lead. Marking every form submission as a key event and importing it into Google Ads teaches bidding to buy cheap newsletter signups instead of sales. Keep ecommerce goals tied to
purchase, and import other actions as secondary unless they are real leads. - Staging and test orders. A staging copy with the live tags sends fake purchases into your real property. Set
WP_ENVIRONMENT_TYPEtostagingin the copy's wp-config.php and gate tags on it, as the snippet does, and refund test orders on live through the proper process. - Gateways that skip the thank-you page. If customers pay off-site and never come back, the browser never fires
purchase. Compare GA4 purchases against WooCommerce orders by payment method to find the gap.
Testing WooCommerce GA4 tracking with Tag Assistant and DebugView
- Log out of WordPress, or use a private window, so admin exclusions do not hide your test.
- Open Tag Assistant at tagassistant.google.com (or GTM's Preview mode), connect your store, and accept the cookie banner.
- In GA4, open Admin, then DebugView. Tag Assistant switches on debug mode for your session, so your events appear there within seconds.
- View a product, add it to the cart, check out with a test or low-value real payment, and confirm each event appears once.
- Click the
purchaseevent and checktransaction_idmatches the WooCommerce order number,valueexcludes tax and shipping,currencyis right, and every item is present. - Reload the order received page. No second
purchaseshould appear. - Repeat with the consent banner declined, and with each payment gateway you offer.
Do this on staging first with a separate GA4 property, then once on live. Do it again after any checkout, theme or plugin change. The DebugView help page explains the debug mode switch if events are not appearing.
Common questions
Does WooCommerce track conversions in GA4 automatically?
No. WooCommerce records orders in its own database and its own Analytics screens, but sends nothing to Google on its own. You need the Google Analytics for WooCommerce extension, another tracking plugin, or a GTM setup with a dataLayer.
Why is my WooCommerce purchase event firing twice?
Usually because two things send it, such as a plugin and a GTM tag, or because the thank-you page was reloaded and nothing guards against a second send. Check GTM Preview for two purchase hits, then make sure every send uses the order number as transaction_id and fires once per order.
Why are some WooCommerce orders missing in GA4?
Expect some gap: consent refusals, ad blockers and customers who never return from an off-site payment page all remove purchases from browser tracking. A large or sudden gap points to a broken tag, a cached thank-you page, a checkout change, or a payment method that skips the order received page.
Should I import GA4 conversions into Google Ads or use the Google Ads tag?
Importing the GA4 purchase key event is simpler and keeps both tools on the same numbers. The native Google Ads tag adds view-through conversions and is the usual base for enhanced conversions. Either works; just do not set both as primary for the same sale.
Does GA4 tracking work with the WooCommerce block checkout?
Yes, for the purchase event on the order received page. Checkout-step events that relied on the classic checkout's jQuery events need rebuilding for the block checkout, and anything attached to woocommerce_thankyou needs the order confirmation template to keep its "Additional information" block.
Next step
If you want tracking you can bid on before the holiday rush, our WooCommerce development team can audit your current setup or build it properly, with a fixed price agreed first. Start a project and tell us which tools you use.
Want a senior developer to look at your site?
Tell us what you need. You get a written scope and a fixed price, usually within one business day.


