February 5, 2019
Google Tag Manager in footer. How bad is it?
I recently received this question from one of the readers who is just starting with GTM and faced some real-life limitations. Google Tag Manager official recommendation states that in order to install it you need to place the <script> code somewhere in the website’s <head> and the <noscript> part should be added immediately after the opening <body> tag. But what should you do if a performance-obsessed developer does not agree to follow these instructions? Or maybe your content management system does not allow to place the code in the <head>?
The result is that both Google Tag Manager codes are added somewhere in the <body>, most likely even somewhere in the footer. If that’s the case, you’re probably wondering what will be the consequences to your tracking implementation if Google Tag Manager is in the footer.
This blog post will be pretty short and more of a quick rant. So what happens if GTM is added to the website footer?
In general, it will work just fine. The only thing that is affected is the time when it will load. The higher GTM container snippet is placed in the page source code, the sooner it will load, and obviously, the sooner your tags will start firing and tracking visitor’s interactions.
So if the circumstances do not enable you to follow Google’s recommendations, don’t panic. You’ll still be able to use GTM.
The only combination that will make your website’s code invalid is if someone added the 2nd GTM code (<noscript>) to the <head>. All other options are ok. I’ve explained them in greater detail here.
Just keep in mind that in such case, there will be a higher chance that GA and other tracking tools within GTM will not catch some visitors at all. If your website loads pretty slowly and the visitor abandons the site before the GTM container in the footer managed to load (this must happen quite rapidly), your analytics/marketing tools will miss it (because GTM was not loaded at that moment and Google Analytics (or other tags) were not fired yet.
Unfortunately, I cannot give you numbers of how many visitors can you possibly miss in your analytics reports under these circumstances. There are too many variables and conditions that affect this. A.k.a. IT DEPENDS.
Google Tag Manager in Footer: Summary
All in all, it’s not the end of the world if Google Tag Manager code snippets are added to the footer. While it will affect the timing when your tags fire, it will still be possible to track visitors’ interactions on a website.
Additionally, if you’re facing the resistance from developers or other stakeholders who reject GTM at all and don’t want to use it in their website/app, read this blog post where I give tip on how to convince someone to start using GTM and what argument should you tell.
That’s it. As promised, the blog post was indeed very short. The main key takeaway is that you should not pull your hair out if Google Tag Manager is in the footer. Better focus on other things that really matter like quality data collection and analysis.