Magento GA4 tracking can come from the built-in Google integration, which supports GA4 through the gtag APIs from version 2.4.5, from the Google Tag Manager integration that ships with Adobe Commerce only, or from a third-party extension. Pick one of them per GA4 event, make sure prices and revenue arrive as numbers, and keep customer-specific data out of fully cached pages. Then test the purchase on the success page with every payment method you offer.
Magento GA4 tracking tends to be built in layers. A store moves from Universal Analytics to GA4, adds an extension for the dataLayer, switches on Adobe Commerce's Google Tag Manager setting, and nobody removes the previous layer. The result is purchases sent twice, revenue sent as text, and cart data that belongs to someone else. This page covers how tracking works on Magento Open Source and Adobe Commerce, the mistakes behind wrong numbers, and how to set up Adobe Commerce Google Tag Manager and GA4 properly.
How Magento GA4 tracking works
Magento offers three routes to GA4, and you should use one per event:
- The native Google integration. From release 2.4.5 the integration uses Google's gtag APIs, and the
Magento_GoogleGtagmodule implements GA4 and Google Ads. You enable it under Stores > Settings > Configuration > Sales > Google API, in the Google Analytics4 section, with your measurement ID. - Google Tag Manager in Adobe Commerce. Adobe documents GTM as an Adobe Commerce-only feature, provided by the
Magento_GoogleTagManagermodule. In the same Google API section you set the account type to Google Tag Manager and enter the container ID. The integration publishes ecommerce events to the dataLayer for GTM to use. - A third-party extension or custom code. Common on Magento Open Source, which has no built-in GTM setting, and on stores that need a dataLayer shaped differently from the native one.
Versions before 2.4.5 only offered the Universal Analytics integration. Universal Analytics stopped processing data in July 2023, so a store still relying on it needs an upgrade or an extension, not a configuration change.
What full page cache means for the dataLayer
Magento serves most pages from full page cache, usually Varnish. Adobe's documentation separates public content, cached and shared by all visitors, from private content such as the cart and customer name, which is loaded in the browser through the customer data sections. For tracking this matters in one specific way: anything specific to a visitor, such as cart contents, customer group or a hashed email for enhanced conversions, must come from that private content. If an extension prints it into the HTML of a cached page, the next visitor receives the previous visitor's data.
The common mistakes
| Mistake | What you see | Cause |
|---|---|---|
| Double purchases | GA4 purchases above Magento orders | Native GA4 enabled and a GTM GA4 purchase tag, or an extension on top of either |
| Revenue sent as text | Odd or missing revenue, totals that do not add up | Prices, tax, shipping and revenue sent as strings; Adobe published patch ACSD-51294 for this in its own integration |
| Missing currency | Purchases with no revenue in reports | value sent without currency, which GA4 requires |
| Leaked or stale user data | Cart or customer values from another session | Private data printed into fully cached pages |
| Universal Analytics leftovers | Old tags firing with no effect, or errors in the console | UA configuration and extensions never removed after the move to GA4 |
| Payment returns | Missing purchases for some payment methods | Offsite payment that does not return to the success page, or returns twice |
The duplicate case deserves care. GA4 only merges purchases from the same user with the same transaction ID, so two installations with slightly different IDs or client IDs get through. Our guide on duplicate purchase events shows how to find them by transaction ID.
How to set up Adobe Commerce Google Tag Manager and GA4
- Inventory the current setup. Check the Google API configuration at every scope (default, website, store view), installed tracking extensions, and theme templates for hard-coded gtag or GTM snippets.
- Choose the source. If GTM will send GA4 events, disable the native GA4 sending for the same property. On Adobe Commerce, use the GTM account type; on Open Source, choose one extension.
- Check your version and patches. On 2.4.5 or later the gtag-based integration is available. If revenue arrives as strings, apply the relevant quality patch or upgrade.
- Agree the dataLayer. Write down which events the store pushes, their names and their parameters, ideally in a dataLayer specification. If the native events do not match GA4's ecommerce names, map them in GTM or ask the developer to push GA4-shaped events.
- Build the GTM side. GA4 event tags with Custom Event triggers, dataLayer variables for
ecommercefields, and Consent Mode defaults that your cookie banner updates. - Test real orders. Place orders with a card and with each offsite payment method, check the success page in Tag Assistant and GA4 DebugView, and compare transaction IDs with the order numbers in the Magento admin.
The purchase GTM expects follows Google's ecommerce reference, with numbers as numbers and the order's increment ID as the transaction ID:
dataLayer.push({ ecommerce: null });
dataLayer.push({
event: "purchase",
ecommerce: {
transaction_id: "000012345",
value: 129.9,
tax: 22.55,
shipping: 4.95,
currency: "EUR",
items: [
{ item_id: "MJ01-S-Blue", item_name: "Beaumont Summit Kit", price: 62.5, quantity: 2 }
]
}
});Use the same increment ID in the Google Ads conversion tag and the Meta pixel, so each platform can deduplicate. If the store runs several store views with different currencies, send each order's own currency, not the base currency.
Magento conversion tracking for Google Ads
The native integration covers Google Ads through gtag as well, which makes it easy to end up with two primary purchase conversions: one from the Google Ads tag and one imported from GA4. Keep one primary and set the other to secondary, and pass the increment ID as the transaction ID.
What Tracking Whisper does on a Magento store
Tracking Whisper does not connect to the Magento admin and does not change the store's configuration, extensions or theme. It works through GTM, GA4 and the live site:
- Audit. A fixed set of checks on the GTM container, including duplicate GA4 configurations, purchase tags without currency or transaction ID, and leftover Universal Analytics tags. See the GTM audit.
- Build. GA4 and Google Ads tags, triggers and variables in its own GTM workspace, published only after a person approves the version.
- Developer guide. Where the store must push different data, it writes the dataLayer guide and measurement plan for your Magento developer.
- Browser checks. It opens key pages in a real browser and checks the dataLayer, the hits and the consent state, which shows string values and double hits directly.
- Monitoring. It watches container versions, key pages and GA4 numbers, and alerts when purchases stop or leave their usual range. See monitoring.
Next step
Connect your GTM container and GA4 property to Tracking Whisper and run an audit of your Magento or Adobe Commerce setup. Agencies running several stores can see how client access levels work on the agencies page.
Frequently asked questions
Does Magento Open Source support GA4?
Yes. From the 2.4.5 release the Google integration uses the gtag APIs, and the Magento_GoogleGtag module implements GA4 and Google Ads. You enable it under Stores, Configuration, Sales, Google API by entering your GA4 measurement ID. Older versions only had the Universal Analytics integration, which stopped processing data in July 2023.
Is Google Tag Manager built into Magento?
Only in Adobe Commerce. Adobe documents Google Tag Manager as an Adobe Commerce-only feature, configured under Sales, Google API with the account type set to Google Tag Manager and your container ID. On Magento Open Source you add GTM through an extension or a theme change.
Why does GA4 show odd revenue from my Magento store?
Check whether price, quantity, tax, shipping and revenue arrive as strings. Adobe published a quality patch, ACSD-51294, for exactly that problem in its Google Analytics and GTM integration. Also check that the event sends currency, which GA4 requires whenever value is set.
Can I run the native GA4 integration and GTM at the same time?
You can, but not for the same events. If the native integration sends the purchase to a GA4 property and a GTM tag sends it as well, GA4 receives two purchases for one order and only merges them when the same user sends the same transaction ID. Choose one source for each event.
How does full page cache affect Magento tracking?
Cached pages are shared between visitors, so anything specific to a customer, such as the cart contents or login state, is not in the cached HTML. Magento loads that private content separately in the browser through customer data sections. A dataLayer for cart or user data has to be built from that private content, not printed into a cached page.
Sources
- Google Analytics, Adobe Commerce Admin Guide
- Google Tag Manager, Adobe Commerce Admin Guide
- Magento_GoogleGtag module, Adobe Commerce developer documentation
- ACSD-51294: Price, quantity, tax, shipping, revenue sent as string to Google Analytics and GTM, Adobe Experience League
- Private content, Adobe Commerce developer documentation
- Measure ecommerce, Google Analytics developers
Last updated by Dimitris.