I'm trying to set up Universal Analytics through Google Tag Manager in Magento 2.3.2.
I follow the official doc, or other tutorials, but in my backend, when I go to Store>Sales>Google API>Google Analytics
and enable it, I have no dropdown Account Type. Any idea what I am missing ?
1 Answer
You have set up wrong for Google Tag Manager.
These option used for google analytics like UA-1344454
You can easily add GTM 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:
// YourTheme/Magento_Theme/templates/html/gtm_head.phtml
<script>..</script> <!-- GTM code -->
// YourTheme/Magento_Theme/templates/html/gtm_body.phtml
<noscript>..</noscript> <!-- GTM code -->
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 GTM is added you can set up Google Analytics and other tools for tracking and reporting about website traffic.
-
Thank you, I might do that. However in the magento official tuto there is a Account Type dropdown in the configuration page which allows to select GTM and enter the tracking id. Is it only a Enterprise Edition feature ? Jul 11, 2019 at 6:57
-
1