Don’t confuse Google Tag Manager (GTM) with the latest version of Google Analytics, as it helps to set up the GA and any other code.
Magento 2 GTM relatively consists of 3 main parts:
The app eliminates the need to have deep knowledge in JavaScript and make everything manually. Instead of it, you can add a container tag (a custom-generated tracking code) to your website and add, change, debug tags, of course, if you have the appropriate user permissions.
You can easily add Google Tag Manager in Magento 2 without third-party extensions. All you need is to add the GTM code to your active theme. The GTM code is divided into two parts: script and noscript.
You need to put the GTM snippet into these two phtml templates for head and body:
To load the files correspondingly you should use the default .xml file:
<!-- YourTheme/Magento_Theme/layout/default.xml -->
<referenceContainer name="head.additional">
<block class="Magento\Framework\View\Element\Template" name="gtm.head" before="-" template="Magento_Theme::html/gtm_head.phtml" />
</referenceContainer>
<referenceContainer name="after.body.start">
<block class="Magento\Framework\View\Element\Template" name="gtm.body" before="-" template="Magento_Theme::html/gtm_body.phtml" />
</referenceContainer>
After Magento 2 Google Tag Manager adding process is finished, you can set up Google Analytics and other tools for tracking and reporting about website traffic.
Seamlessly integrate your Magento 2 store with Google Analytics 4 with our extension →
If connecting 3rd-party extensions to your Magento 2 isn't really an option right now, check out this Advanced Reports extension: 20+ marketing reports, sales performance reports, real-time reports, create custom reports, customizable data grids.
We use cookies to help improve our services, make personal offers, and enhance your experience. If you do not accept optional cookies below, your experience may be affected. If you want to know more, please read the Cookie Policy
Please select and accept your Cookies Group
Cookie Name | Cookie Provider | Cookie Description | Cookie Lifetime | Cookie Type |
---|---|---|---|---|
Login and Registration Form