Overview
The Google Tag Manager extension adds the GTM container script to every page of your Magento 2 storefront and populates a dataLayer with ecommerce events. Once the container is live, you can deploy and update any analytics or marketing tag — Google Ads, GA4, Meta Pixel, Hotjar, or any third-party tag — directly from the GTM web interface without touching the store’s codebase.
Compatible with Magento 2.3–2.4 Open Source, Adobe Commerce, and Adobe Commerce Cloud. A Google Tag Manager account (free) is required.
How It Works
The extension injects the GTM container snippet into the <head> and <body> of every storefront page using Magento’s layout system. It also pushes structured dataLayer events as shoppers interact with the store — product impressions, clicks, cart changes, checkout steps, and purchase. Tags configured in the GTM interface can listen to these dataLayer events and fire accordingly.
Multi-store setups are supported: each store view can be assigned its own GTM container ID from the Admin configuration.
Features
- GTM container injection — adds the GTM
<head>and<body>snippets to every storefront page - dataLayer events — product impressions, product clicks, product detail views, add/remove from cart, checkout steps, and purchase
- No-code tag deployment — add or update any marketing or analytics tag from the GTM web interface without a code deploy
- Remarketing support — dataLayer signals feed audience lists in Google Ads, Meta, and other platforms
- Multi-store and multi-language — separate GTM container IDs configurable per store view
- GDPR consent sync — tag firing respects user consent preferences set across the GTM consent mode
- Third-party tag support — deploy any tag available in the GTM tag library, including custom HTML tags
- Admin configuration — manage GTM container ID, dataLayer settings, and enable/disable from Stores → Configuration
- ACL-aware — configuration section access controllable via Magento Admin roles
Use Case
Adding tracking and marketing scripts individually to a Magento 2 theme requires a developer for each change, ties tag versions to store deployments, and creates an unmanageable tangle of scripts as the number of tags grows. GTM separates tag management from the codebase — marketers can add a retargeting pixel or update a conversion event without a release cycle.
This extension handles the one integration that does require a code change (installing the GTM container itself) and ensures the dataLayer is populated with accurate ecommerce data for downstream tags to consume.
Benefits
- Add or update any tracking tag without a store deployment
- Accurate ecommerce dataLayer events available to all GTM tags
- Single place to audit and control every third-party script on the storefront
- GDPR consent managed at the GTM layer, applied consistently across all tags
- Works as the data foundation for GA4 Ecommerce, Google Ads, Meta, and other integrations