One piece of Google advice not to follow when installing Tag Manager

23 August 2018

I love Google Tag Manager, I really do. But when you install it, don't follow the advice that Google gives you:

Google Tag Manager instructions

The installation code shouldn't be pasted as high in the <head> of the page as possible. It should be pasted below the data layer snippet. As Google itself explains elsewhere:

It's important that this data layer snippet be set above the container snippet as described in the Quick Start Guide.

If the data layer code is called after the container snippet, any variables declared within will not be available for Google Tag Manager to selectively fire tags on page load.

And the Quick Start Guide has an even clearer warning:

If you put the Google Tag Manager container snippet above the dataLayer array, Google Tag Manager may malfunction, and will not be able to read the variables defined in the array.

So there you go. Don't put the GTM snippet as high in the <head> as possible. Put it below the data layer snippet.

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © James Clark
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram