cancel
Showing results for 
Search instead for 
Did you mean: 

Google Tag Manager Extension

Google Tag Manager Extension

Hi,

I have installed Google Tag Manager Extension

Here: Stores -> Configurations -> Google tag manager-> we placed code: 

 

Google Tag Manager Code (Head)
Google Tag Manager Code (Body)

 

But "Google Tag Manager Code (Head)" script do not getting.
Only Body Code Snippet was showing in firebug Console..

Please advise...

 

 

6 REPLIES 6

Re: Google Tag Manager Extension

@soho_rize

What tag manager extension are you using? Normally you wouldn't be expected to put the entire GTM script in the extension. You'd only have to put your  GTM client ID. 


Could you share the screenshot please? 

Magento Certified Solution Specialist | Lead Magento developer
If this response was helpful to you, consider giving kudos to this post

Re: Google Tag Manager Extension

We installed "Anowave Google Tag Manager" on the website.

We have options to add head and body code snippets...only head code was not getting.

I asked support why, and here is what they told:

 


We believe your theme has a block removed. If you look at app\code\Anowave\Ec\view\frontend\layout\default.xml you will see that our scripts are hooking to block with name head.additional. I have attached the location of this reference, check if you have it.gtm-error.png

Re: Google Tag Manager Extension

What is your theme's layout xml? Can you post both xmls here?

One from your theme and the extension? 

Magento Certified Solution Specialist | Lead Magento developer
If this response was helpful to you, consider giving kudos to this post

Re: Google Tag Manager Extension

Extension - default.xml:

====================

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="head.additional">
            <block class="Anowave\Ec\Block\Track" name="ec_header" as="ec_header" template="header.phtml" />
            <block class="Anowave\Ec\Block\Track" name="ec_purchase" as="ec_purchase" template="purchase.phtml" >
                <block class="Anowave\Ec\Block\Track" name="ec_datalayer" as="ec_datalayer" template="datalayer.phtml" />
                <block class="Anowave\Ec\Block\Track" name="ec_impressions" as="ec_impressions" template="impression.phtml" />
                <block class="Anowave\Ec\Block\Track" name="ec_search" as="ec_search" template="search.phtml" />
                <block class="Anowave\Ec\Block\Track" name="ec_detail" as="ec_detail" template="detail.phtml" />
            </block>
        </referenceBlock>
        <referenceContainer name="after.body.start">
            <block class="Anowave\Ec\Block\Track" name="ec_noscript" as="ec_noscript" template="noscript.phtml" />
        </referenceContainer>
        <referenceContainer name="before.body.end">
            <block class="Anowave\Ec\Block\Track" name="ec_events" as="ec_events" template="events.phtml" />
            <block class="Anowave\Ec\Block\Track" name="ec_footer" as="ec_footer" template="footer.phtml" />
        </referenceContainer>
    </body>
</page>



Theme - default.xml:
=================

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="page.wrapper">
            <container name="breadcrumb1.container" as="breadcrumb1" label="Breadcrumb1 Container"  htmlTag="div" htmlClass="breadcrumb1 content" before="main.content" />
        </referenceContainer>
        <referenceContainer name="header.panel">
            <block class="Magento\Framework\View\Element\Html\Links" name="header.links">
                <arguments>
                    <argument name="css_class" xsi:type="string">header links</argument>
                </arguments>
            </block>
        </referenceContainer>
         <referenceBlock name="top.links">
            <block class="Magento\Theme\Block\Html\Header" name="header" as="header" before="-">
                <arguments>
                    <argument name="show_part" xsi:type="string">welcome</argument>
                </arguments>
            </block>
        </referenceBlock>
        <referenceBlock name="logo">
            <arguments>
                <argument name="logo_img_width" xsi:type="number">148</argument>
                <argument name="logo_img_height" xsi:type="number">43</argument>
            </arguments>
        </referenceBlock>
        <referenceContainer name="footer">
            <block class="Magento\Store\Block\Switcher" name="store_switcher" as="store_switcher" after="footer_links" template="switch/stores.phtml"/>
        </referenceContainer>
        <referenceBlock name="report.bugs" remove="true"/>
        <referenceBlock name="top.search" remove="true"/>
        <move element="copyright" destination="footer" after="footer_static_block_links"/>
        <move element="page.main.title" destination="content" before="-"/>
        <move element="minicart" destination="header.links" afrer="-"/>
        <move element="catalog.compare.link" destination="breadcrumb1.container" />
        <move element="breadcrumbs" destination="breadcrumb1.container" />
        <referenceBlock name="footer_links" remove="true" />
        <referenceBlock name="copyright" remove="true" />
        <referenceContainer name="footer">
            <referenceBlock name="form.subscribe" remove="true" />
            <block class="Magento\Cms\Block\Block" name="footer_static_block_links">
                <arguments>
                    <argument name="block_id" xsi:type="string">lloyd-mats-footer</argument>
                </arguments>
            </block>
        </referenceContainer>
    </body>
</page>



 

Re: Google Tag Manager Extension

Hi,

I have posted the xml files as you asked.

Can you please suggest any solution for this..

Re: Google Tag Manager Extension

Hi,

I have posted the xml files as you asked.

Can you please suggest any solution for this.