
Analytics & Tag Manager for Magento 2 — GA4 Data Layer & Server-Side Tagging
Analytics & Tag Manager gives Magento 2 — especially headless storefronts — accurate GA4 ecommerce tracking. Magento builds the full GA4 data layer (every standard event) server-side per page type and serves it over GraphQL, with GTM and server-side tagging, Google Ads conversions, consen…
Accurate GA4 ecommerce tracking — even when your storefront is headless
GA4 ecommerce reporting is only as good as the data layer behind it, and on a headless Magento the storefront can't lean on Luma's templates to emit one. Analytics & Tag Manager fixes that at the source: Magento builds the full GA4 data layer — every standard ecommerce event, with the right product, cart and order data — server-side per page type, and serves it over GraphQL. Your Astro or PWA front end injects the tags; Magento supplies the structured events. Add server-side tagging, Google Ads conversions, consent mode and purchase de-duplication and you get analytics you can actually trust.
The events it builds
The GA4 ecommerce funnel is covered end to end, each event fired on the right page type with the right payload:
What you'll use it for
- Make headless analytics actually work — get a reliable GA4 data layer on an Astro or PWA storefront, where the front end can't emit Magento's own.
- Track Google Ads conversions — fire conversions with order value so your campaigns optimise on real revenue.
- Survive ad blockers — route events server-side so cookie loss and blockers don't quietly erode your numbers.
- Stop inflated revenue — purchase de-duplication keeps a refreshed confirmation page from counting an order twice.
- Stay compliant — ship a consent-mode default so tags respect a shopper's choice.
How it works
Configurable & transparent
Point it at your GA4 and Google Ads IDs, choose whether products are keyed by SKU or ID, pick the brand attribute, and set a consent-mode default. The GTM server container configuration can be exported for your own server-side GTM, and an admin dashboard surfaces the headline metrics and reports so you can see what's being tracked without leaving Magento. Purchase de-duplication prevents a re-loaded order-confirmation page from sending a second purchase event.
Specifications
| Magento | Open Source 2.4.9 and later 2.4.x |
|---|---|
| PHP | 8.4 and 8.5 (verified) |
| Data layer | Full GA4 ecommerce events, built server-side per page type |
| Delivery | GraphQL (headless) for client tagging; server-side via Measurement Protocol |
| Tag managers | GA4, Google Tag Manager, exportable GTM server container |
| Advertising | Google Ads conversion tracking with order value |
| Privacy | Consent-mode default; purchase de-duplication |
| Config | Product identifier (SKU/ID), brand attribute, IDs; admin dashboard & reports |
| Dependencies | None — no third-party libraries |
| Delivery & licence | Composer install, per-domain licence key, updates via Composer |
Works with
Part of the AgenticEcom suite for SEO & Content:
Included in the Growth and Enterprise bundles.
Frequently asked questions
How do I add GA4 ecommerce tracking to a headless Magento 2 store?
Magento builds the full GA4 data layer server-side and exposes it over GraphQL, so your Astro or PWA storefront reads the events and fires GA4/GTM — without trying to reconstruct Magento's data layer itself.
Which GA4 events does it produce?
The full ecommerce funnel: view_item_list, view_item, select_item, add_to_cart, remove_from_cart, view_cart, begin_checkout, add_shipping_info, add_payment_info and purchase, plus search, login and sign_up.
Does it support server-side tagging?
Yes. It can route events server-side via the Measurement Protocol and export a Google Tag Manager server container, so tracking holds up against ad blockers and cookie restrictions.
Can it track Google Ads conversions?
Yes. It fires Google Ads conversions with order value, so campaigns can optimise on real revenue.
Will it double-count purchases or ignore consent?
Purchases are de-duplicated so a re-loaded confirmation page can't count an order twice, and a consent-mode default is included so tags respect the shopper's choice.
Which Magento and PHP versions are supported?
Magento Open Source 2.4.9 and later 2.4.x, verified on PHP 8.4 and 8.5, with no third-party dependencies.

