How to Install Google Tag Manager?

Team TypeStack
Team TypeStack ...
Dec 02, 2022  . 3 min read
Table of Content

You have started using Google tag manager, and you have created an account and a container. So, what now? Well, it's time to install it on your website. In some cases, you will be able to achieve that by yourself but in other situations, you might need to ask for a developer's help. 

A quick guide to installing Google Tag Manager

To install Google Tag Manager on a website, Google is asking you to add two codes to the website. If you want to find those codes, you need to go to your Google Tag Manager interface and click on the container ID. Each container has a unique ID; click on the ID and you will see two codes. Here, you need to add the first code to the head of the website and the second code right after the opening body tag. 

Head and body tags explained 

If you're wondering what the head and the body tag mean, every website has two parts- the head and the body. The head is responsible for containing various scripts, settings, meta information, keywords, title, and so on. On the other hand, the body is the place where all the content is stored. For example- images text and other elements. 

Once these two codes are added to the website, here's how things will work. Whenever a visitor lands on your website and the browser loads all the content onto the page, along with all the scripts, the Google tag manager will be launched on your website. It will activate your tags based on the conditions that you have configured in your Google tag manager container.

How to add the codes?

It’s important to keep in mind that every website and every account management system is different. So in your case, the place where you will edit the code might be different. You should first copy the first code and then place it somewhere in the head (the higher the better). But it's perfectly fine to put it right before the end of the head so you can identify the head by seeing this slash. The second code should be added immediately after the opening body tag. 

To sum up, we have two codes; one of the codes is surrounded by script tags. We added that code right before the closing head tag. After the opening body tag, we added the second code. The easiest way to check whether that code is properly added is to go to Google tag manager and enable the preview mode. As a result, the orange banner will appear. Now, if we go to the front end of the website as a visitor, and we see a preview mode, it means that we have installed Google tag manager correctly.


So, that’s all about how to install Google Tag Manager without any fuss. Having a developer by your side can definitely simplify the process. However, spending even a few hours can provide you with much clarity on how the entire interface works.