In order to install Google Tag Manager, you have to place its container code on your website. If you’re using some 3rd party plugin to install GTM, all you need to provide is Google Tag Manager ID.
However, in many other cases, you will need to place the entire container code snippet to the source code of your website. This quick guide will show you all the places where that code can be found.
Option #1. Code is displayed right after you create a container
When you sign up for a new Google Tag Manager account here, you will be asked to create a new container. Follow all the steps and you’ll see the container code. If you already have at least one GTM container, you can then go to the main list of all your Google Tag Manager accounts and choose one of the two options:
a) You can create a new account (e.g. for your client) and then create a container
b) Or you can click 3 dots next to the already existing account and then chooseCreate Container
Then follow all the steps and after you hitCreate…
You will see a popup that looks like this (see below). These are the codes you’re looking for.
P.S. All my screenshots here are related to theWebcontainer of Google Tag Manager.
Option #2. Click GTM container ID in the top menu bar
Log in to your Google Tag Manager account and open a container. In the top right corner (next to theSubmitandPreviewbuttons) you’ll see some short text that starts withGTM-and then contains some letters/numbers. That’s your Google Tag Manager container ID.
Click that ID (as I’ve displayed above) and you’ll see a popup with two codes. Both of them will contain that very same Google Tag Manager ID. That’s it! You’ve found the Google Tag Manager container code.
Important:the first code is required for GTM to work. It must be placed as high in the website’s source code as possible (recommended in <head>). When someone asks you to add the GTM code, THIS IS THAT CODE. The 2nd code must not be added to the <head>. Add it right after the opening <body> tag instead. Read this blog post for more details.
Options #3. Go to the Admin section of your container
One more place where you can find the container code is by going to the Admin section of the container. In the top menu of your Google Tag Manager interface, click Admin.
Then in the 2nd column (container), click Install Google Tag Manager.
Then you will see both GTM codes that need to be added to the site’s source code.
Remember, the first code (surrounded byscript tags) is the most important. It MUST be added to the website. The 2nd code (surrounded bynoscript tags) is optional. You can learn more about it here.
Related resources
Here are some additional guides you will find useful:
- How to properly install Google Tag Manager?
- How to check if Google Tag Manager is working?
- Google Tag Manager Tutorial for Beginners