cancel
Showing results for 
Search instead for 
Did you mean: 

Need to add Google Tag Manager Script after the body tag

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Need to add Google Tag Manager Script after the body tag

I was given a Google Tag script from corporate that needs to be added to our Magento site immediately after the opening <body> tag.  I can't locate in the System>Configuration area how to do this.

 

We are using Magento ver. 1.12.0.2

2 REPLIES 2

Re: Need to add Google Tag Manager Script after the body tag

Hi @QlikMarketAdmin

There is no universal solution for it. You can add the code to the corresponding templates. Alternatively, you can add this to your local.xml

 

<default>
<reference name="after_body_start">
<block type="core/template" before="-" template="your_template_with_google_code.phtml"/>
</reference>
</default>
Was my answer helpful? You can accept it as a solution.
230+ professional extensions for M1 & M2 with free lifetime updates!

Re: Need to add Google Tag Manager Script after the body tag

Thanks for the suggestion. I ended up adding the script to a new static block and then created a widget to position this at the "Page Top".  This placed the script immediately after the openning <body> tag as desired. However I should note that using a static block will always insert the script within a <div> tag.

 

Haven't recieved testing results back yet but i believe this method succesfully added the script to each page on the site.