WooCommerce Google Analytics 4 Setup: Install the Extension and Track Ecommerce Events
A neutral setup guide for WooCommerce store owners: install the official GA4 extension, see which shopper actions become which GA4 events, find out why purchases go missing, and test the setup with a real order.
In short
Install the free Google Analytics for WooCommerce extension, open WooCommerce, Settings, Integration, Google Analytics, paste your G- Measurement ID and save. It then sends GA4 ecommerce events such as view_item, add_to_cart, begin_checkout and purchase. Add a consent plugin that supports the WP Consent API, and test while logged out.
The official way to connect WooCommerce to Google Analytics 4 is the free Google Analytics for WooCommerce extension, maintained by WooCommerce. You install it, paste your GA4 Measurement ID (the ID that starts with G-) into its settings, and it sends GA4's standard ecommerce events for product views, cart changes, checkout and purchases. Three things decide whether the data is complete: the payment gateway must bring shoppers back to the order received page, a consent plugin must tell the extension when visitors agree to tracking, and you must test while logged out.
Which Google plugin you need
Google's own WooCommerce help page splits the job by tag ID. Tags starting with G- belong to Google Analytics, and Google points you to Google Analytics for WooCommerce for those. Tags starting with AW- belong to Google Ads, and Google points you to a different plugin, Google for WooCommerce, whose setup also asks you to choose a product catalogue. Many stores run both.
Before you install anything, find your Measurement ID. In GA4, click Admin at the bottom left, then under Data collection and modification click Data streams, open the Web tab, click your website stream, and copy the Measurement ID from the first row of the stream details. If you do not have a web data stream yet, create one there first.
Install and connect the extension
- 1Remove any other Google Analytics code first: another analytics plugin, a tag pasted into the theme header, or a GA4 tag in a Google Tag Manager container. The extension's FAQ warns that duplicate code causes tracking conflicts.
- 2Install Google Analytics for WooCommerce, either from the WordPress plugin directory in your WordPress admin or with the Add to store button under My subscriptions in your WooCommerce.com account, then activate it.
- 3Go to WooCommerce, then Settings, then the Integration tab, then Google Analytics.
- 4Paste your G- Measurement ID into the Google Analytics Tracking ID field.
- 5Leave the event tracking checkboxes ticked unless you have a reason to turn one off (they are explained in the next section), then save.
- 6Allow time. WooCommerce's documentation says the connection can take up to 48 hours to start working, so use DebugView rather than standard reports to confirm the first events. Google's help page also mentions a Use Global Site Tag box; current versions of the extension no longer have it.
Which shopper actions become which GA4 events
Each setting maps to these GA4 events in the extension's source code.
| Setting | GA4 event | When it fires |
|---|---|---|
| Purchase Transactions | purchase | When the order received page loads after payment |
| Add to Cart Events | add_to_cart | When a product is added to the cart |
| Remove from Cart Events | remove_from_cart | When a product is removed from the cart |
| Product Impressions from Listing Pages | view_item_list | When the shop page, a category or related products are shown |
| Product Clicks from Listing Pages | select_content | When a shopper clicks a product in a listing |
| Product Detail Views | view_item | When a single product page is viewed |
| Checkout Process Initiated | begin_checkout, add_shipping_info, add_payment_info | When checkout opens, then as shipping and payment are chosen |
| Track 404 (Not found) Errors | Not an ecommerce event (WooCommerce describes it as an Error event) | When a visitor lands on a page that does not exist |
Three details matter when you read the reports. First, product clicks arrive as select_content with a content type of product, not as select_item, the list click event in Google's ecommerce guide. Second, since version 2.2.0 the purchase event uses the order number as transaction_id. That equals the order ID unless a sequential order number plugin changes it. Third, since version 2.4.1 the purchase value is the sum of item price times quantity, excluding tax and shipping, which are sent separately. GA4 revenue will therefore sit below your WooCommerce order totals even when every purchase is recorded.
Why the WooCommerce purchase event is not tracking
The purchase event is sent by the shopper's browser on the order received page (the thank-you page). WooCommerce's documentation states that purchase tracking requires a payment gateway that redirects there after payment, and names WooPayments, Stripe, PayPal Braintree, PayPal Payments and Square as examples. Any purchase where that page never loads in the shopper's browser with tracking allowed is lost. The common causes:
- The shopper pays on the gateway's own site and closes the tab before being sent back, or the return redirect fails. WooCommerce records the order; GA4 never hears about it.
- You placed the test order while logged in as an administrator. The documentation says pageviews are not tracked for logged-in admin users, and the code switches tracking off for them entirely.
- The visitor is in the EEA, the UK or Switzerland and has not granted consent, or your consent plugin never passes the choice on.
- The order failed or was cancelled. Since version 2.4.4 the extension skips purchase for those orders, so a later successful payment for the same order can still be recorded.
- A plugin replaced the thank-you page with a custom URL. The extension only sends the order if the URL carries the order key that WooCommerce adds to its standard order received address.
- An ad blocker, a browser extension or a JavaScript error on the page stopped the Google tag. The documentation suggests checking the browser console and testing with extensions disabled.
Watch the opposite case too. The extension does not skip orders that are on hold, and WooCommerce usually puts direct bank transfer orders on hold until you confirm the money has arrived, so GA4 can count a bank transfer sale that is never paid. Shoppers returning from an off-site gateway can also start a new session credited to the gateway; our guide to payment gateway referrals in GA4 covers that fix, and GA4 purchase revenue missing or zero covers purchases that arrive without a value.
Consent mode: the extension needs a consent plugin
The extension supports Google consent mode, but it has no cookie banner of its own. It sets the four consent signals (analytics_storage, ad_storage, ad_user_data and ad_personalization) to denied by default for visitors in the EEA, the UK and Switzerland, and waits for a consent plugin to update them. It does this through the WP Consent API, a shared WordPress interface that lets consent plugins and tracking plugins talk to each other. WooCommerce's documentation is blunt about the result: without consent, GA4 and Google Ads will not capture user data in those locations.
So pick a consent management platform that Google recommends and that has a WordPress plugin compatible with the WP Consent API, and check that it sends an update after the visitor accepts. If it does not, WooCommerce advises contacting that plugin's developer. Since version 2.4.2, if the consent plugin works in opt-in mode, undecided visitors in any country are also marked as denied until they accept. Developers can change the defaults with the woocommerce_ga_gtag_consent_modes filter. For what the four signals mean, see Google consent mode v2 explained.
Avoid counting purchases twice
Duplicates come from a second tool sending purchase to the same property, such as an old plugin, a theme option, Tag Manager or a server-side integration. GA4 does deduplicate purchase events from the same user that carry the same transaction ID, but that only helps when both tools send the identical value. If one sends the order ID and another sends a custom order number, GA4 sees two different transactions. Google's transaction ID page also warns never to send an empty transaction ID, because GA4 then treats all those purchases as duplicates of each other and undercounts.
The safe rule is one source of purchase events per GA4 property. If you also import GA4 purchases into Google Ads, check under Goals, then Conversions, then Summary that only one purchase conversion action is set as Primary; Secondary actions are for observation only and do not drive bidding unless they belong to a custom goal. Our guide to duplicate conversions covers the same problem on other platforms.
Test with a real order
- 1Log out of WordPress, or open a private window, and disable ad blockers for the test.
- 2Open Tag Assistant at tagassistant.google.com, click Add domain, enter your store's address and click Connect. Tag Assistant adds a debug parameter to your site's address: accept your cookie banner on that page so the Google tag can fire.
- 3In GA4, go to Admin, then under Data display click DebugView. Tag Assistant switches on debug mode for your browser, so your events appear there. Events sent while consent is denied do not appear in DebugView.
- 4Browse a category, open a product, add it to the cart, remove it, add it again and start checkout. Confirm view_item_list, view_item, add_to_cart, remove_from_cart and begin_checkout appear once each.
- 5Pay for a real low-value order with each payment method you offer, including any that leave your site. Click purchase in DebugView and check that transaction_id matches the WooCommerce order number and that currency and value are present.
- 6Reload the order received page. No second purchase should appear, because the extension marks each order as tracked after sending it.
- 7Refund and cancel the test orders, then check standard reports after 24 to 48 hours.
To check that only one GA4 tag is on the page, run your product page through the pixel inspector. It fetches the page as a logged-out visitor and lists the tags in its initial HTML, so a second GA4 tag from a theme or old plugin shows up; it cannot see tags injected later by Tag Manager. Our GA4 DebugView guide explains the DebugView screen in more depth.
When browser tracking is not enough
Everything above runs in the shopper's browser, so closed gateway tabs, blocked scripts and declined consent all remove purchases, while the order itself still exists in WooCommerce. Our guide to WooCommerce server-side conversion tracking compares the options. EndFrame is one of them: it records conversions with its own snippet and can forward them to GA4 through the Measurement Protocol. Its snippet also runs in the browser, so ad blockers and consent choices still apply to it. If you send purchases to GA4 that way, untick Purchase Transactions in the extension so each purchase reaches GA4 from one source only.
Frequently asked questions
Is the Google Analytics for WooCommerce extension free?
Yes. WooCommerce's own documentation calls it a free extension, and it is also listed in the WordPress.org plugin directory. The same documentation points to a separate paid product, Google Analytics Pro for WooCommerce, for more advanced reporting needs. The free extension covers the standard GA4 ecommerce events described in this guide.
Why is GA4 revenue lower than my WooCommerce sales total?
Partly by design. Since version 2.4.1 of the extension, the purchase value is the sum of item price times quantity, excluding tax and shipping, which are sent as separate parameters. The rest of the gap usually comes from purchases that never reached GA4: shoppers who did not return from the payment page, visitors who declined consent, and blocked scripts.
Can I use Google Tag Manager instead of the extension?
You can, but Google's WooCommerce help page recommends the official integration over custom checkout tracking built from Tag Manager triggers, page scraping or JavaScript listeners, because those break when the theme or WooCommerce templates change. If you do use Tag Manager for GA4, deactivate the extension so each event is sent once.
Do I need Google for WooCommerce as well?
Only for Google Ads. Google's help page assigns tags starting with AW- to the Google for WooCommerce plugin and G- tags to Google Analytics for WooCommerce. Running both is normal, but check in Tag Assistant that your G- ID is loaded only once and that only one tool sends purchase to GA4.
Sources
- 1.Google Analytics for WooCommerce Documentation - WooCommerce
- 2.WooCommerce: Set up your Google tag - Analytics Help
- 3.Minimize duplicate key events with transaction IDs - Analytics Help
- 4.Measure ecommerce - Google Analytics - Google for Developers
- 5.Monitor events in DebugView - Analytics Help
- 6.woocommerce/woocommerce-google-analytics-integration - GitHub
Try EndFrame
Add a server-side path for your conversions.
EndFrame collects events first-party and forwards conversions server-side to Meta, GA4, TikTok, and webhooks with event-ID deduplication — then credits each conversion to its campaign, with the visit-to-conversion path you can audit.
No credit card required