Google Tag Manager - Add Code Behind <Body> Tags

Hello, I have decided to use Google Tag Manager on one of our sites that we do a lot of marketing for to consolidate all of the scripts that are needed to be run.


  1. First of all, if you think this is a bad idea, I'd like to hear your opinion …
  2. I would like to know the best way to implement it. GTM is placed behind the opening tag … Should we make a hook, or edit a template?



    Either way, I need someone to be kind enough to show me how to do this … any helpers out there?



    Thanks in advance!

For our clients, we use a “content.pre.tpl” hook and put the iframe code there. It's a few lines below the body tag, but it does come before any real content that you would want to track.

[quote name='tbirnseth' timestamp='1431804972' post='214613']

For our clients, we use a “content.pre.tpl” hook and put the iframe code there. It's a few lines below the body tag, but it does come before any real content that you would want to track.

[/quote]



Thanks tbirnseth,



I'm not a client, but sure could use the help …



So I create the file in this folder

[color=#000000]design[/color][color=#666600]/[/color][color=#000000]themes[/color][color=#666600]/[[/color][color=#000000]THEME_NAME[/color][color=#666600]]/[/color][color=#000000]templates[/color][color=#666600]/[/color][color=#000000]addons[/color][color=#666600]/[/color][color=#000000]my_changes[/color][color=#666600]/[/color][color=#000000]hooks[/color][color=#666600]/[/color][color=#000000]index[/color][color=#666600]/[/color][color=#000000]content[/color][color=#666600].[/color][color=#000000]pre[/color][color=#666600].[/color][color=#000000]tpl[/color]



[size=4][color=#000000]and from there I put the code in [/color][color=#000000]content[/color][color=#666600].[/color][color=#000000]pre[/color][color=#666600].[/color][color=#000000]tpl … is that it?[/color][/size]

Hey [color=#282828][font=arial, verdana, tahoma, sans-serif]tbirnseth,

I built the template above and put the following code in and the website hangs … am I missing something?[/font][/color]