Magento 2 Google Tag Manager | Google GA4 & Ads

Magento 2 Google Tag Manager is an extension for Magento that connects stores to Google Tag Manager, Google Analytics 4, and Google Ads directly in the admin and supports both client-side and server-side tracking through the GTM server container, GA4 Measurement Protocol, Google Tag Gateway or custom GTM loaders. The extension comes with a pre-built GTM data layer for web and server containers with all tags, triggers, and variables ready for import to GTM. It tracks 13+ essential eCommerce events from page_view and add_to_cart to purchases, refunds, logins and scrolls, including rich customer, order and product parameters (with item- and event-based custom dimensions).

Magefan GTM Extension is fully compatible with GDPR, Google Consent Mode, multi-store setups and provides deferred GTM script loading so the data tracking is reliable, user-friendly and compliant across all store views and installations. Fully compatible with Magefan Facebook Pixel Extension.

Pricing plans:
Compare Plans and Pricing
$199
one-time-payment-info
one-time payment
Add to Cart
Not
a subscription
60 days
money back
365 days
of free support and updates
one-time-payment-info
Lifetime
access to source code
magento 2 google tag manager
magento gtm tracking
magento 2 ecommerce conversion tracking
add google tag manager to magento
Live DemoLive Demo
Compatibility:Magento 2.3.0 - 2.4.9 (CE, EE, ECE, B2B)
Version:2.8.1
Downloads
100,000 downloads
Github
GitHub
Composer
Composer
Mage-OS
Mage-OS
Hyva
Hyvä
Breeze
Breeze
Made in Ukraine
Cloud
Made in Ukraine
Made in Ukraine

Why Do You Need Magento Google Tag Manager?

Magento doesn’t support Google Tag Manager integration or Google Analytics 4 enhanced eCommerce tracking by default. Without it, your reports on products, checkout performance and ad campaigns are incomplete. Magefan Google Tag Manager extension allows you to track rich product, order and customer data through 13+ eCommerce events and send them to Google Tag Manager, Google Analytics 4 and Google Ads automatically.

relevant

Track Product Performance

Track exactly what products get the most attention (view_item, view_item_list), which drive leads (add_to_wishlist), which are added or removed from carts (add_to_cart, remove_from_cart), which are purchased (purchase) and refunded (refund) the most. The Magento GTM Extension tracks the full product journey along with product details such as item ID, brand, category, variant price, coupon code and more.
relevant

Monitor Customer Behaviour

Track how many visitors become customers and how often they return (sign_up, login). Monitor customer engagement on your website, including their interests (search), time on the page (scroll, scroll_depth_%) and other actions beyond the cart (click, form_submit and file_download) for both registered and guest visitors. This helps you understand intent before sales happen.
relevant

View Checkout Performance

Magento 2 Google Tag Manager helps you track every step of the checkout journey. Monitor how many carts move to checkout (begin_checkout) and check what steps cause the drop-offs ( add_shipping_info, add_payment_info). Track orders (purchase) from both the frontend and admin panel with details like transaction ID, tax, shipping rates, payment options and more.
relevant

Build Custom GA4 Reports

Magefan GTM modules send rich item, page, order, customer parameters and multiple custom attributes to Google Analytics 4 to help you create custom GA4 reports. Build reports around shipping, tax, coupons and currency, customer IS, group or guest status, page type or name and custom dimensions for both events and items.
relevant

Track Data Even With AdBlockers

Avoid data mismatches in your reports or inconsistencies in the conversion data with the GTM extension for Magento. Enable both browser-based (web container) and server-based (server GTM, GA4 measurement ID, Google Tag Gateway) tracking to track the entire funnel even when users decline cookies, use browser restrictions and ad blockers.
relevant

Get Rich Google Ads Tracking

Give Google Ads complete and accurate conversion data powered by the same data layer you use for GA4. This Google Tag Manager Extension support Google Ads Enhanced Conversions, Google Ads Conversion Tracking, and Google Ads Dynamic Remarketing, along with new customer acquisition data to optimise your Ads campaign and budget.

Track Data Reliably with Magento 2 Google Tag Manager Extension

Google Tag Manager for Magento is a reliable solution for data tracking that is built for speed, accuracy, compliance and scale. It replaces manual GTM script management with the pre-built data layer and automatic container generation for both web and server-side tracking on multi-store and multi-currency setups.

add google tag manager to magento

Integrate Google Tag Manager with Magento in Minutes

Skip code editing and manual GTM script management in your website's tag. Magento Google Tag Manager Extension allows you to integrate GTM directly in the admin without any developers involved.

Just create a web or server GTM container and add your GTM container ID, account ID, public ID, and GA4 Measurement ID in the admin.

Export the ready-made data layer with all the tags, triggers and variables to your GTM account and start tracking immediately.

Track 13+ eCommerce Events

Magefan GTM module track all important eCommerce events along with multiple order, customer, item and page details with each event, out of the box. No additional setup required.

  • - Browing events:page_view, view_item_list, select_item, view_item.
  • - Cart events: add_to_cart, view_cart, remove_from_cart, add_to_wishlist.
  • - Checkout events: begin_checkout, add_shipping_info, add_payment_info.
  • - Revenue events: purchase, refund.
  • - Engagement events: login, sign_up, search, scroll, scroll_depth, file_download, click, form_submit.
magento ecommerce conversion tracking
magento datalayer for gtm and ga4

Use Pre-built Magento Data Layer for GTM

No need to build a GTM data layer for Magento from scratch. Magento 2 Google Tag Manager Extension comes with pre-built data layers for both web and server containers that connect your Magento with GTM, GA4 and Google Ads.

  • - Order data: transaction ID, value, tax, shipping, currency, coupon, items, shipping description, virtual product status, customer status and ID.
  • - Product data: ID, name, URL, brand, categories, price, quantity, discount, coupon, variant and index.
  • - Customer data: identifier, names, email, telephone, city, region, postcode, gender, country and customer group, depending on consent settings.

Ensure Complete Google Consent Mode Compliance

Keep your tracking compliant and accurate with the built-in consent logic.

Magefan’s Google Tag Manager module for Magento works with Google Consent Mode, Magefan’s Magento cookie consent extension and native cookie settings out of the box.

Set consent to “denied” and fire GTM tags for web or server containers only after users accept cookies.

magento gtm cookie compliance
google tag manager script loading magento

Delay GTM Script Loading

Collect data for GTM without sacrificing loading speed, SEO or user experience. Use Magento Google Tag Manager to delay GTM script loading until visitors interact with the page.

  • - Load GTM script on scroll or click: load starters after the first interaction.
  • - Track real visitors’ data: trigger GTM only for legitimate users.
  • - Protect Core Web Vitals: keep vital speed score high.

Track Data with Multi-store GTM in Magento

Magefan Google Tag Manager fully supports multi-store and multi-currency setups to help you track relevant data across several markets without any complex setups.

Create and assign a different GTM container for each store view to keep campaigns separate by market, within one admin setup.

See exactly how each market performs, which campaigns convert best, and where to invest your budget next.

multi store gtm tracking magento

Enable Server-Side Tracking in Magento

Bypass browser restrictions, ad blockers and customers who don’t accept cookies to get accurate data using server-side tracking in Magento. All events with all parameters are tracked via the Magento server and sent to the Google servers, so no data is lost or broken. Magefan Google Tag Manager for Magento supports three server-side tracking methods: server GTM, GA4 Measurement Protocol and Google Tag Gateway, which you can easily configure directly from the admin.

relevant

Use GA4 Server-Side Tracking

GA4 Measurement Protocol is one of the simplest, cost-free ways to set up server-side tracking. It sends data from your server to Google Analytics 4 directly with no server tagging or host. Just get a GA4 API secret, paste it into your admin panel and run GA4 Measurement Protocol in Magento alongside browser tracking.
relevant

Track Data via GTM Server Container

Use GTM server container in Magento to send data to both GA4, Google Ads and other platforms from one controlled place. Just create a separate server GTM container, paste the container, account, and public IDs together with the server tag URL inside your Magento admin and export the ready-made Server data layer GTM. Magefan makes server-side tagging in Magento super simple.
relevant

Enable Google Tag Gateway

Serve Google tags from your domain for first-party loading with Google Tag Gateway in Magento. Avoid the complexities of the server-side tracking setup and work with your existing web GTM setup. Enable Google Tag Gateway to track data more reliably and get more ownership over your data.

Integrate Google Ads and Google Analytics 4 to Magento

Magento 2 Google Tag Manager by Magefan connects Magento with Google Analytics 4 and Google Ads from a one single extension, including Google Ads Enhanced e-commerce. The data goes to both platforms through one GTM container and the same data layer to ensure accuracy and consistency.

Connect Google Analytics and Google Ads to Magento

You don’t need a separate Magento Google Analytics 4 Extension to set up GA4 and Google Ads for Magento. All you need is to add your measurement ID, conversion and label IDs directly in your admin panel.

Magefan’s Google Tag Manager extension creates the right tags in your GTM container with all important triggers and variables.

Set up, trigger, and track data for all three Google channels with a single data layer export.

add google analytics 4 to magento
google ads conversion tracking in magento

Set up Magento Conversion Tracking and Dynamic Remarketing

Connect Google Ads to Magento through GTM to fix attribution and get accurate conversion data via web or server-side tracking.

  • - Measure purchases by campaign, ad group and items using Google Ads Conversion Tracking.
  • - Build audiences from product views, items added to wishlists or removed from carts for smart Google Ads dynamic remarketing campaigns.

Use Built-in Google Enhanced Conversions

Send hashed first-party customer data, like email and region, to improve matching and bypass cookie restrictions.

Magento Google Tag Manager offers built-in Enhanced Conversions for Google Analytics 4 and Google Ads. All customer data is hashed before it’s sent to Google and respects the consent mode settings.

Recover missed orders and improve Google Ads with reliable data.

google enhanced conversions in magento

Get the Most Out of Data Tracking with Magento GTM Extension

Magefan Google Tag Manager with GA4 support includes not only basic GTM and GA4 setup, but advanced tracking settings for accurate order data, custom reports, product attribute matching and safe testing.

relevant

Use GA4 Custom Dimensions

Except for the standard GA4 events with all the parameters, the Magento 2 GTM Extension allows you to pass any item-scoped parameters and event-scoped parameters to GA4. Collect extra product and event details to build custom reports based on your needs.
relevant

Optimize Order Tracking

Magefan GTM Extension offers multiple options to optimise order tracking and data accuracy. Prevent duplicate orders when using web- and server-side tracking, track orders with specific statuses, track orders created in the admin panel, pass customer ID with each order, track checkout shipping and payment options.
relevant

Test and Adjust Tracking Workflows

Magento Google Tag Manager plugin comes with a built-in GTM debug preview for server-side GTM to help you verify the connection. You can also block the store IPs and 404 pages from tracking to exclude staff sessions and broken pages from your analytics.
Track Data Seamlessly with PWA or Hyvä GTM in Magento

Magefan GTM module for Magento works with Hyvä, Hyvä Checkout, Breeze, GraphQL PWA, and headless storefronts, so you can switch between architectures and themes without breaking the existing GTM and GA4 setups. The extension also supports custom GTM loaders so you can use your own GTM head script and body noscript for tracking.

FAQs

Does Magento support Google Analytics 4 natively?

collapsible icon
Magento does not support Google Analytics 4 enhanced eCommerce tracking by default. To implement proper GA4 eCommerce tracking with events like item_view, add_to_cart, begin_checkout, and purchase Magento store owners need a third-party extension like Magefan GTM, which provides a pre-built GA4 data layer and GTM container with all required tags and triggers.

Does this extension support server-side tracking?

collapsible icon
Magefan GTM Extension supports three server-side tracking options: GTM Server Container, GA4 Measurement Protocol, and Google Tag Gateway. You can use the GTM web container together with the Google Tag Gateway or GA4 Measurement Protocol, or switch to the GTM server container.

Is the extension compatible with Google Consent Mode and GDPR?

collapsible icon
Yes. It’s compatible with Google Consent Mode, Magento native cookie consent feature, and Magefan Consent Mode Extension and collects data only after consent.

What customer params do you pass to the datalayer?

collapsible icon
The extension passes parameters such as customer ID, first and last names, telephone, email, postcode, city, region and customer group, depending on the event and consent settings.

How do you know if Google Tag Manager is working?

collapsible icon
Once you import the JSON file to your GTM account, open the debug view and trigger different events in your store. Besides, there are also other ways to test if GTM is working.

Can this GTM extension send data from different store views to separate GTM accounts?

collapsible icon
Yes, Magefan Google Tag Manager fully supports multi-store and multi-currency setups. So, you can set up different GTM containers per store view for region-specific tracking.

Is the extension compatible with Hyvä Theme and Hyvä Checkout?

collapsible icon
Magefan Google Tag Manager is fully compatible with the Hyvä Theme and Hyvä Checkout out of the box. You don’t need to install any extra packages for Hyvä compatibility.

What is the best Google Tag Manager Extension for Magento?

collapsible icon
Magefan stands out from other GTM extensions for Magento by covering everything for reliable, compliant and error-free eCommerce tracking for Magento and offering both client-side and server-side tracking setup directly from the admin with pre-built data layers for both. It is the only Google Tag Manager module that covers GTM server and web containers, Google Analytics 4 Measurement Protocol, Google Tag Gateway and custom GTM loaders all in one place, which helps merchants and marketers to optimise and scale data tracking without having to migrate or recreate the GTM setup from scratch if they want to switch between web abd server-side tracking.

Is there a separate file for the server GTM container?

collapsible icon
The extension supports both web and server GTM containers and correspondingly offers two pre-built GTM data layers. If you have the GTM web containers enabled, the Export Web Container option is available at the bottom of the config section. And if you want to switch to the GTM server container, you will only have Export Server Container enabled.

Note: you can’t use both web and server GTM containers for the same website. If you want to enable server-side tracking together with the web container, try using GA4 server-side Measurement Protocol or Google Tag Gateway within the GTM web container.

Can I add custom attributes to the GTM data layer with Magefan Google Tag Manager?

collapsible icon
Magefan Google Tag Manager supports item-based and event-based custom dimensions that allow you to send multiple product, order, and page details with each event in your store to both GA4 and Google Ads.

Does upgrading to the GTM Extension Plus or Extra plan break any existing functionality or cause any data mismatch issues?

collapsible icon
The upgrade itself doesn’t influence your existing GTM setup since all the tags, triggers and variables are tracked according to the data layer you export to your GTM account. Once you upgrade the Magefan GTM extension plan, you’ll see new tracking events or server-side tracking optio

ns. If you change any settings in the admin, you must export the updated web and import it to your GTM account once again. If you want to switch to a server GTM container, there should still be no data mismatch if the destination (GA4 and Google Ads) accounts and conversion labels and IDs are the same.

Does this Magento Google Tag Manager support the Meta Pixel?

collapsible icon
Magefan Google Tag Manager Extension supports and creates data layers for GTM with GA4 and Google Ads support out of the box. It doesn’t automatically track or send data to the Meta Pixel. We offer a separate Facebook (Meta) pixel extension for that.

Does this extension offer event deduplication when the browser-side and the Measurement Protocol purchase event are both sent?

collapsible icon
Magefan Google Tag Manager comes with built-in event deduplication for cases when both web and server-side tracking are used. When an order is tracked, Magefan GTM records it in the dedicated magefan_gtm_transaction table to prevent duplication.

People Also Searched For
magento google tag manager
magento 2 google tag manager
google tag manager extension magento
google tag manager extension magento 2
google tag manager extension
google tag manager magento extension
google tag manager magento 2 extension
google tag manager magento 2
google tag manager for magento 2
magento 2 google tag manager
gtm magento
magento 2 gtm extension
gtm magento 2

Key features

No-code GTM & GA4 integration

Connect Google Tag Manager and GA4 via tracking and measurement IDs

Advanced conversion events

Plus
Track add_to_cart, remove_from_cart, add_to_wishlist, add_shipping_info, add_payment_info, view_item_list

Server-side tracking

Extra
Set up server side tracking through GTM server container or GA4 Measurement Protocol

Google Ads integration

Plus
Integrate Google Ads, Google Ads Conversion Tracking & Dynamic Remarketing

Custom events tracking

Extra
Track additional events like refunds, scrolls, sign_ins, sign_ups, and on-site search events

Client-side tracking (web container)

Track user interactions in the browser using standard GTM web container setup

Google Tag Gateway

Extra
Load Google tags via your domain to improve tracking reliability and data ownership

Basic event tracking

Track key store events like view_item, view_cart, begin_checkout, purchase

Enhanced Conversions

Plus
Improve conversion accuracy by sending enriched customer data to GA4 and Google Ads

Ready-to-use data layer

Generate ready-to-import GTM tags, triggers and variables automatically

Custom order data tracking

Extra
Track orders created in the admin, orders wth specific statuses, and detailed checkout options data

GDPR compliance

Ensure compliant tracking with Magento Cookie Consent and Google Consent Mode

Extended data tracking

Plus
Collect additional data like page type, page name, Google Ads new customer data

API-based tracking

Extra
Send events via API for headless or PWA storefronts with greater flexibility

Custom dimensions (parameters)

Extra
Pass custom item-scoped and event-scoped parameters to GA4 for more detailed reports
Quick Overview Video

Tracking vital in-store data is easier if you use the right tools. Set up Google Tag Manager for your Magento 2 store and learn more about your customer's behaviour.

Watch this short video to learn how to add GTM to Magento in a few clicks.
Related Products
Magento 2 Facebook Pixel Extension
Facebook Pixel
$99
(11)
Track customers' behaviour in your store with Facebook Pixel to leverage that data in your Facebook campaigns.
Magento 2 TikTok Pixel
TikTok Pixel
$149
(1)
Track customers' behaviour on your store with the TikTok Pixel and Conversion API to optimise your ads and create custom audiences.
Magento 2 Google Shopping Feed
Google Shopping Feed
$99
(18)
Extend your reach and create product feeds for Google Shopping in a few simple clicks. Don't overpay for platforms you don't need.
 

Reviews about Magefan Google Tag Manager

chevron-up Top
Stand with Ukraine! How can you help?
Find out more