Google Tag Manager (GTM) is a great tool for easily adding marketing page tags to your site (especially if you have more than a few elements you would like to track). Once you have made the decision to take advantage of Google’s incredibly easy to use tag management platform, your next step will be to focus on the implementation. GTM saves time and resources when it comes to adding new tags to your pages, but none of this can be beneficial if you have not placed the container code in the correct place on your website.
After you have opened a Google Tag Manager account, GTM will provide you with the unique container code snippet for you to place on your site. Whether you are adding the code yourself or a developer is doing this for you, it is important that this gets placed in the correct location and on every page of your website’s source code.
Proper implementation is one of the most important steps in the set up process since incorrectly placing the code can lead to misfires and a loss of data collection. While some may assume the Google Tag Manager code gets placed where your Universal Analytics tracking code used to live, this is not the case. Rather, Google suggests you add the code immediately after the opening body tag of your HTML document.
Google has recommend adding the GTM container code directly inside of the body and not placed within another tag. Adding the container code inside any other tag could prevent certain tags from firing correctly. A potential reason for this could be the <noscript> tag, used in the first line of your GTM code snippet, which, if placed in the head tag of your pages might not validate when using certain versions of a browser. For best results, the code should be added immediately following the opening body tag.
In addition to Google’s reference, a couple other reasons for placement here are to ensure you’re collecting the most significant information as quickly as possible. The GTM snippet should fire as soon as possible. Google has designed the tags you place on your site via Google Tag Manager to fire asynchronously. Basically, this means the tags placed via Google Tag Manager load independently of other elements on the page. In other words, even if a GTM tag is loading slowly, it will not affect the overall load time of the web page or affect the user experience.
Why would you risk delaying the GTM code from loading by placing it anywhere else? Your Google Tag Manager code should live in the body of the page’s HTML, ideally right after the opening body tag in order to best capture your web traffic data.
Making the decision to transition your site from the standard Google Analytics tracking code to a tag management system like Google Tag Manager is the first step towards easier maintenance of your web analytics tools. Now that you have read and understood this post you can move on to the correct implementation and placement of the Google Tag Manager container snippet on your website.