Some CMS’s are not built with a global top <body> include (only a global header or footer include) or there is a need to do a like-for-like replacement of GA in the header for GTM in the header. Thus, here are some possible alternatives…

Existing GA setup:



GTM setup options:

1. DataLayer in <head> and GTM in top <body> (2 include files) – recommended option:


2. Both DataLayer & GTM in top <body> (1 include file) – second best option:


3. Both DataLayer & GTM JavaScript in <head>, with GTM iframe in footer (2 include files) – IE7 use with caution:



  • Google Webmaster Tools verification only works in option1.
  • For option3: If customHTML is used, then a blocking-rule/patch for IE7 must be added for example: userAgent JavaScript variable which matches RegEx ^.+ (.*MSIE [6-7].0; .*).*$
  • For option3: GTM team does not test GTM in <head> thus there is no guarantee that it will continue to work the future.
0117 3361103