4GLte.eu Posted March 13, 2017 Share Posted March 13, 2017 I am always confused if the instruction says paste the code to all pages. Does it mean I need to go to themes/MyTheme/*.tpl and change paste to every tpl file? Link to comment Share on other sites More sharing options...
HanzCZ Posted March 13, 2017 Share Posted March 13, 2017 Where do you need to paste this code? If you need this code in <head>, locate /themes/yourtheme/header.tpl... Link to comment Share on other sites More sharing options...
HanzCZ Posted March 13, 2017 Share Posted March 13, 2017 GTM needs script in <head> and iframe after the opening <body>. Use {literal}GTM_script{/literal} Link to comment Share on other sites More sharing options...
4GLte.eu Posted March 13, 2017 Author Share Posted March 13, 2017 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) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XYZZZZZ" 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 More sharing options...
HanzCZ Posted March 14, 2017 Share Posted March 14, 2017 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) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XYZZZZZ" 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 More sharing options...
4GLte.eu Posted March 14, 2017 Author Share Posted March 14, 2017 <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 More sharing options...
HanzCZ Posted March 15, 2017 Share Posted March 15, 2017 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 More sharing options...
Web Curator Posted May 25, 2017 Share Posted May 25, 2017 (edited) 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 June 6, 2017 by Web Curator (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now