Magento 2 Google Tag Manager Extension
Add GA4 ecommerce tracking and Google Tag Manager to your Magento 2 store without editing theme code.
The extension sends 17 GA4 events, from product list views to refunds, comes with ready GTM containers for GA4 and Google Ads, and shows every event in a built-in debug toolbar.
- Track every step from product list to purchase and refund in GA4.
- Track clicks on any storefront element by CSS selector.
- Send customer data for Google Ads Enhanced Conversions through GTM.
- Gather non-standard information by adding custom dimensions and metrics.
Magento Open Source sends only the purchase to GA4, and Google Tag Manager support comes only with Adobe Commerce. Tracking every step before the order means a developer builds the data layer by hand.
The extension builds the data layer (the event data GTM reads) for 17 GA4 events and gives you ready GTM containers. Paste your GTM code, import the container and check each event in the debug toolbar.
Is it worth it for your store?
What you get
All 17 GA4 events in one edition, plus Google Ads conversions and remarketing. Used by 1,000+ Magento stores.
What it takes
Minutes. We install it for free, guide you through the Google setup and check that the events arrive.
Where it stops
Ad blockers stop browser events, so GA4 may show fewer orders than Magento. For per-customer journeys, use Mixpanel.
Main features of Magento GA4 and Google Tag Manager extension
- 17 GA4 events in a ready data layer, no theme code to edit
- Ready GTM containers for GA4 and Google Ads to import
- Google Ads conversion tracking and dynamic remarketing
- Refunds and admin orders sent to GA4 server-side
- Custom dimensions and metrics from product, customer and order attributes
- Built-in debug toolbar that shows every event as it fires
- Separate GTM container per store view, prices in store currency
- Works with Luma, Hyvä (including Hyvä Checkout) and Breeze, Magento Open Source and Adobe Commerce 2.3–2.4.9
What you'll see in GA4
Where checkout loses buyers. The begin_checkout, add_shipping_info, add_payment_info and purchase events show in the Checkout journey report at which step shoppers leave.
Which campaigns pay off. Every purchase carries revenue, tax, shipping, coupon and a new or returning customer flag, so GA4 and Google Ads attribute real money to each campaign.
How segments and products perform. Customer group and product variant travel with the events, so you can split any report by wholesale and retail buyers, or by size and color.
For raw, event-level behavior analysis next to GA4 (funnels, retention and per-customer journeys), add our Magento 2 Mixpanel extension.
Google Analytics 4 (GA4) support
The extension pushes GA4 ecommerce events to the data layer in the format Google expects, and the ready container turns them into GA4 tags. Refunds from credit memos and orders created in the admin never happen in the shopper's browser, so the extension sends them to GA4 server-side via the Measurement Protocol. All other events stay in the browser, so no purchase is counted twice. GTM server containers and Google Tag Gateway aren't supported.
Google Consent Mode v2 works together with Mirasvit GDPR Cookie Consent: it sets the ad_storage, analytics_storage, ad_user_data and ad_personalization signals, and your Google tags follow the shopper's choice. With another consent tool, set consent inside Google Tag Manager.
The extension sends these GA4 events:
view_item_listselect_itemview_itemadd_to_wishlistview_cartadd_to_cart, remove_from_cartbegin_checkoutadd_shipping_infoadd_payment_infopurchaserefundsearchsign_uplogin, logoutsubscribe_newsletterGoogle Ads conversions and dynamic remarketing
Add your Conversion ID and label, and every purchase is reported to Google Ads as a conversion. Every event with products carries the dynamic remarketing parameters, so your remarketing ads show the products a shopper actually viewed. The tags come in a ready container (see how to configure Google Ads).
For Enhanced Conversions, the purchase event also carries the customer's email, phone and address. You switch Enhanced Conversions on in Google Tag Manager, and the Google tag hashes the data before sending it (see how to set up Enhanced Conversions).
Why the numbers in GA4 match your store
Tracking code that only works on a clean test page breaks on a real store. The extension handles the cases that usually skew the numbers:
- Search engine bots (Google, Bing, Baidu, Yandex) don't trigger product and category views
- Product list views stay correct with layered navigation, AJAX pagination and cached category pages
- Large categories are sent in batches of 30 products, within the GA4 limit per event
- Prices can be sent in the store view currency instead of the base one
- A command-line check builds the event data for any product and reports empty IDs, missing prices or broken values, so you can run it after catalog changes or in a deployment check
Built-in Debug Toolbar
Know exactly what information is sent to Google Analytics with every action.
Open any storefront page with ?debug=gtm and the toolbar shows each GTM event with its full data as it fires. If you also run other Mirasvit trackers, ?debug=tm shows all of them, one tab per tracker. Every event is also written to a log on the server. It works alongside Google Tag Assistant, which shows what GTM does with the same data.
Custom dimensions and metrics from Magento 2 Google Analytics 4
Gain deeper insights into your customers' behavior by collecting non-standard data through custom dimensions and metrics. For example, the extension can send brand, special price, customer group, tax class, dynamic weight, payment method and other product, customer and order attributes to your Google Analytics reports.
Track clicks on any storefront element
Banners, custom product blocks or a size chart tab: the extension can track clicks on any element you point it to with a CSS selector, and send them to GTM along with the ecommerce events. Setting up a selector is a technical task, usually done by your developer.
Set up in minutes, without editing code
Paste the GTM code and the no-script code into the admin, then enter your GTM account, container and GA4 measurement IDs. The extension gives you a ready container file for GA4 and another for Google Ads, with tags, triggers and variables already filled in with your IDs. Import them into Google Tag Manager, publish, and check the events in the debug toolbar. The quick start guide walks through each step.
One data layer for all your pixels
GA4 and Google Ads are built in. Facebook Pixel, TikTok Pixel and Mixpanel are separate Mirasvit extensions that run on the same data layer. Add any of them and they get the same events, products and totals as GA4, while attribute mapping, event exclusions and debugging stay in one place.
Still comparing GA4 and Google Tag Manager extensions? Our comparison of the main Magento 2 GTM and GA4 extensions puts nine of them side by side on price, server-side tracking, Consent Mode v2 and Hyvä, including where another one is the better fit.
Save time by starting your support request online and we'll connect you to an expert.
What is the purpose of the Google Tag Manager?
Google Tag Manager (GTM) is a free Google service for managing the tracking code on your website. For an online store, it tracks events such as a product added to the cart, a product viewed in the catalog or shipping information entered at checkout.
GTM gives store owners a browser interface, so they can change tracking tags without editing the store's source code.
GTM has three main parts:
- Tags: pieces of code, usually JavaScript, that send data to a service such as Google Analytics
- Triggers: rules that decide when a tag runs
- Variables: values that tags and triggers use, such as the product price
You can create a separate tag for every event you want to track. GTM then sends the collected data to services like Google Analytics, where it becomes ecommerce reports about your Magento 2 store.
Why use an extension instead of Magento's built-in tracking?
Magento's own Google Tag Manager module comes only with Adobe Commerce. Magento Open Source ships the Google Gtag module instead: it connects GA4 by Measurement ID and tracks the purchase on the success page, but doesn't load a GTM container or track product, cart and checkout events.
Without an extension, a developer has to build the data layer for every event in your theme. The extension does this for 17 GA4 events, gives you ready GTM containers for GA4 and Google Ads, and sends refunds and admin orders to GA4 server-side.
How do I set up the extension?
Setup takes minutes, and the free installation includes it: we install the extension, walk you through the steps in your Google accounts and check that the events arrive. The steps are:
- Create a Google Analytics 4 property and a Google Tag Manager account
- Paste the GTM code and the no-script code into the extension settings in the Magento admin
- Enter your GTM account, container and GA4 measurement IDs, download the ready container and import it into Google Tag Manager
- Publish the container and check the events in the debug toolbar
See the quick start guide for details.
How do Enhanced Conversions work with this extension?
The purchase event in the data layer carries the customer's email, phone and address in the format Google expects. You turn on Enhanced Conversions for your Google Ads conversion tag in Google Tag Manager and point it to these fields; the Google tag hashes the data before sending it.
See how to set up Enhanced Conversions for the step-by-step guide.
Does it support server-side tracking?
Partly. Refunds from credit memos and orders created in the admin panel never happen in the shopper's browser, so the extension sends them to GA4 server-side via the Measurement Protocol. All other events, including storefront purchases, are sent from the browser, so no purchase is counted twice.
GTM server containers and Google Tag Gateway aren't supported.
Will the extension slow down my store?
Most of the weight comes from the GTM container itself and the tags you add to it, not from the extension. The extension accepts the GTM code as you paste it, so you can use a delayed version that loads GTM after the page: see how to defer Google Tag Manager.
On its side, the extension sends large product lists in batches and doesn't track search engine bots.
Does it work with Consent Mode v2 and my cookie banner?
Yes. With Mirasvit GDPR Cookie Consent, the Consent Mode v2 signals (ad_storage, analytics_storage, ad_user_data and ad_personalization) are set automatically, and your Google tags follow the shopper's choice. With another consent tool, set consent inside Google Tag Manager.
Does it work with Hyvä and Breeze themes?
Yes. Hyvä support is built in, with no separate compatibility module, and the shipping and payment steps are tracked in Hyvä Checkout too. Breeze storefronts are supported as well, including add to cart, product list views and checkout steps.
Which events does the extension send to Google Analytics 4?
The extension sends 17 GA4 events:
- Catalog: view_item_list, select_item, view_item, search
- Cart and wishlist: add_to_cart, remove_from_cart, view_cart, add_to_wishlist
- Checkout: begin_checkout, add_shipping_info, add_payment_info, purchase
- After the order: refund, and purchase for orders created in the admin
- Customer: sign_up, login, logout, subscribe_newsletter
Which GA4 reports does the extension fill?
With these events, the standard GA4 ecommerce reports work out of the box:
- Ecommerce purchases: views, cart additions and revenue for each product
- Purchase journey: how many shoppers move from product view to cart, checkout and purchase
- Checkout journey: at which checkout step shoppers leave
- Monetization overview: total revenue and average revenue per buyer
What can I send as custom dimensions?
GA4 doesn't collect store-specific data by default. With custom dimensions and metrics, you can send it from product, customer and order attributes, for example the product brand, customer group, payment method or store view.
Why switch from another GTM extension?
Stores that switch to this extension usually name three reasons: it sends more data (17 events and a purchase with shipping, payment and new or returning customer details), it gives full control over what is sent (attribute mapping, custom dimensions, a JavaScript condition to switch events off), and it has a built-in debug toolbar to check every event.
Does it work with Adobe Commerce B2B purchase orders?
Yes. The purchase event is also tracked on the success page of B2B purchase orders.
Blog
We are committed to being open and transparent with our customers. When you purchase our module, you automatically receive one year of free support service and free updates.
Why is this important?
- Seamless Installation and Configuration: We understand that setting up a new module can take time to configure according to your specific needs. That’s why we offer a full year of free support. Our experienced team is here to assist you with installation, configuration, and any questions you might have. We're eager to share our expertise to ensure you get the most out of your purchase.
- Stay Updated with Magento (Adobe Commerce) Releases: Magento releases new versions approximately every three months. These updates can sometimes introduce compatibility challenges. To keep your store running smoothly, we provide a year of free access to the latest versions of our modules, ensuring that you can upgrade Magento and our modules without encountering any obstacles.
- Subscription Included: Renewing your subscription ensures continued access to the latest updates and support from our team. This means you can be confident that any issues you encounter with the extension will be resolved quickly and efficiently. You can cancel your subscription at any time without any additional fees.
These are our primary. A major portion of our new clients come from referrals from our existing clients. Our professional team of developers, marketers and support staff have invested the best knowledge and experience in the field into our work, so you know you can come back to us again and again.
One year free and high quality support. We go to great lengths to provide maximum satisfaction with every module you have purchased in our store. By helping you with installation, configuration, answering your every question, we do all our best to eliminate any possible problems.
30-days money back guarantee. If you are not satisfied with our extension performance for any reason, we provide a full refund.
We constantly add new features to all our modules, and are always interested in hearing your opinion and implementing your suggested features in our future developments.
We provide an expanded user guide for every aspect of our extension, so you can find answers for all your burning questions.
You can customize extension according to your needs and requirements.
The Module is easy to install and upgrade, just follow our step-by-step user guide. Additionally, the extension is ready to use with the Hyvä theme.
No core modifications. The extension has been tested in a Magento Cloud environment and is fully compatible with it.
Andriy Kovalenko
Oleksandr Drok