Jump to content

Google Tag Manager where paste the code?


4GLte.eu

Recommended Posts

Yes that is what I do 

 

 </head>
        <body{if isset($page_name)} id="{$page_name|escape:'html':'UTF-8'}"{/if} class="{if isset($page_name)}{$page_name|escape:'html':'UTF-8'}{/if}{if isset($body_classes) && $body_classes|@count} {implode value=$body_classes separator=' '}{/if}{if $hide_left_column} hide-left-column{else} show-left-column{/if}{if $hide_right_column} hide-right-column{else} show-right-column{/if}{if isset($content_only) && $content_only} content_only{/if} lang_{$lang_iso}">
        {literal}
<!-- Google Tag Manager (noscript) -->
        height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
        {/literal}
 ------------------------------------
 
but on the website I can see the tag error <script> tag must not be included in a <p>
 
Any ideas?
Link to comment
Share on other sites

 

Yes that is what I do 

 

 </head>
        <body{if isset($page_name)} id="{$page_name|escape:'html':'UTF-8'}"{/if} class="{if isset($page_name)}{$page_name|escape:'html':'UTF-8'}{/if}{if isset($body_classes) && $body_classes|@count} {implode value=$body_classes separator=' '}{/if}{if $hide_left_column} hide-left-column{else} show-left-column{/if}{if $hide_right_column} hide-right-column{else} show-right-column{/if}{if isset($content_only) && $content_only} content_only{/if} lang_{$lang_iso}">
        {literal}
<!-- Google Tag Manager (noscript) -->
        height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
        {/literal}
 ------------------------------------
 
but on the website I can see the tag error <script> tag must not be included in a <p>
 
Any ideas?

 

 

I think {literal}{/literal} is necessary to use with scripts. Try to paste <!-- Google Tag Manager (noscript) --> ... <!-- End Google Tag Manager (noscript) --> after the <body> without literal elements. Clean the smarty catche after pasting this code.

Link to comment
Share on other sites

<body{if isset($page_name)} id="{$page_name|escape:'html':'UTF-8'}"{/if}<!-- Google Tag Manager (noscript) -->

        <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XYZ"

        height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

<!-- End Google Tag Manager (noscript) -->class="{if

 

but now it displays me class="index hide-left-column hide-right-column lang_gb"> on the top of the header. ;-(

 

Any idea?
Link to comment
Share on other sites

Because you pasted this snippet into <body>, you need to paste it after your opening body tag. My opening body tag looks like this:

<body{if isset($page_name)} id="{$page_name|escape:'html':'UTF-8'}"{/if} class="{if isset($page_name)}{$page_name|escape:'html':'UTF-8'}{/if}{if isset($body_classes) && $body_classes|@count} {implode value=$body_classes separator=' '}{/if}{if $hide_left_column} hide-left-column{/if}{if $hide_right_column} hide-right-column{/if}{if isset($content_only) && $content_only} content_only{/if} lang_{$lang_iso}">

Code with your snippet:

 

<body{if isset($page_name)} id="{$page_name|escape:'html':'UTF-8'}"{/if} class="{if isset($page_name)}{$page_name|escape:'html':'UTF-8'}{/if}{if isset($body_classes) && $body_classes|@count} {implode value=$body_classes separator=' '}{/if}{if $hide_left_column} hide-left-column{/if}{if $hide_right_column} hide-right-column{/if}{if isset($content_only) && $content_only} content_only{/if} lang_{$lang_iso}">

 

{literal}

<!-- Google Tag Manager (noscript) -->
        <noscript><iframe src="https://www.googleta...?id=GTM-XYZZZZZ"
        height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
{/literal}
 
 
I used facebook pixel ({literal}<noscript><img...></noscript>{/literal}) in head of my shop (PS 1.6, modified default theme) and it worked for me. 
Link to comment
Share on other sites

  • 2 months later...

I suggest to make this steps:

 

1) REMOVE THE COMMENTS

 

<!-- Google Tag Manager -->

<!-- End Google Tag Manager -->

 

2) open a tag {literal} and close it at the end of each snipplet {/literal}

 

{literal}

<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=XXXXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>

{/literal}

 

3) Insert in: head.tpl  (and not header.tpl) one part and the other in layout-both-columns.tpl

 

4) Check if everything is fine via the Chrome Add-on Google-Tag-Assistent 

Edited by Web Curator (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...