gtm container code basics

Google Tag Manager Container Code Basics 2024

The container code is the foundation of Google Tag Manager. And although most of your work will be inside the container as you create tags, triggers, and triggers, it’s also important to know how to deal with the container code itself.

Here is what you’ll learn in this article.

Let’s start with finding the container code within Google Tag Manager.

Where Do I Find the Google Tag Manager Container Code?

First, head on over to and log in.

After you find your account, click into the ‘Admin’ tab from the top menu.

google tag manager menu

Now, click on ‘Install Google Tag Manager’ from the container settings on the right side of the screen.

find google tag manager container code

Boom. You found it. You’ll see two code snippets. When they are both installed on your site, your container code is successfully running. The 7 digit number that follows “GTM-” (in the red boxes below) is your container code ID.

the google tag manager container code

Why are There Two Container Code Snippets?

The first is a javascript code snippet that gets deployed in the <head> of your website. This is the code that executes Google Tag Manager the majority of the time.

The second code snippet is called the noscript tag. This gets placed in the <body> or <footer> and will only come into play in the rare situations where javascript is not running on a browser.

Hopefully you can now install it quickly. If you have a WordPress site, this 4 minute video shows how to get all set up.

How to Create Multiple Containers in the Same Account?

Sometimes you’ll want to have multiple container codes in a single Google Tag Manager account.

No kidding.

Why Would I Need Multiple Container Codes?

One common example is if you have multiple domains for your business or if you have multiple subdomains and want to keep your tags organized for the various subdomains. In Google Analytics 4, cross subdomain tracking is applied automatically, meaning data from and will all be collected together if the same GA4 property is running on both.

Some people like this. Some don’t.

If you’re in the second group, you won’t want the same GA4 Measurement ID deployed on your subdomain blog and on your primary domain. Having a different container code for your primary domain and your subdomain can help you keep this all straight.

Most other reasons for multiple container codes are also related to organization. So, here’s how to create multiple containers.

Option 1: Create from the Admin Section

Head on back over to ‘Admin’.

google tag manager menu

From the ‘Admin’ section, click on the little blue plus sign to the right of your container settings as you can see at the far right arrow below.

google tag manager admin

Now, you can create a new container code. Give your container a name and choose what kind of platform it will be on. In most cases, the answer is ‘Web’ but obviously pick something different if it’s for an app.

Then, hit the blue ‘Create’ button.

create a new google tag manager container

As soon as you do, you’ll be redirected to see your jazzy new container code snippets.

the google tag manager container code

There’s another way you can create a new container code.

Option 2: Create from the Admin Section

You can also create a new container from When you see your account in the list of GTM accounts, click the 3-dot icon in the upper right of the image below. You will see some quick options for easy access.

One of them is “Create Container.” Click that and you’re off to the races once again.

create new gtm container option 2

Whichever option you follow, you’ll now have multiple container codes within your single Google Tag Manager account. It’s similar to how you can have multiple Google Analytics 4 properties within a single Google Analytics account.

You can take your GTM container management to the next level by knowing how to export an existing container and import it to a new account.

Exporting and Importing a GTM Container

Your tags, triggers, and variables exist within your GTM container. And that can take a long time to create properly. Knowing how to export and import can provide some valuable benefits. There are two primary ones:

  1. Backup and recovery: You can create a backup of your container so you have a fall back plan in case you need to restore your container to a prior version
  2. Template creation and transferability: If you work with multiple clients in similar industries you may need similar tags and triggers. You can create efficiencies by exporting your containers and importing them to new accounts.

Here’s how you can do it.

How to Export a GTM Container

Go to “Admin” and then click “Export Container” within your Container settings.

export ga4 container

Then, choose your current workspace or a previously published version that you’d like to export.

export container code options

Your container will be exported as a JSON text file.

How to Import a GTM Container

After you’ve exported the GTM container, go to the second Tag Manager account where you want to import the container. Go to “Admin” and then select “Import Container” in the Container settings.

import ga4 container

Click “Choose container file” to select the JSON text file you exported. You’ll need to choose whether to import the container into a “New” or an “Existing” workspace. And you’ll need to either Overwrite the existing workspace with the container settings you’re importing or to merge the new container with your existing one.

import container code settings

The Overwrite option will remove any existing tags, triggers, and variables from your container and replace them completely with the imported container. This is a great option if you’re starting from scratch.

If you choose to Merge, you’ll be combining the newly imported container with your existing container. You’ll need to choose whether to “overwrite” or “rename” conflicting variables, triggers and tags. Here’s what that option means according to this Google support article.

overwrite or rename existing tags and triggers

User Access Within Your Container

You can also manage your users within your container. As you can see below, you can manage users at the Account level (left side) or at the Container level (right side). If you have multiple containers for various websites, it’s helpful to have container level management so you can make sure the right people have access to the proper resources.

To add someone new to your container, click on “User Management” at the Container level.

add user to gtm container

Then, click the blue plus sign that you can see below at the far right.

container permissions

Enter the email address of the person you’re adding to the container and set their permission level. They will need “Publish” level if you want them to be able to make changes in the container and push those changes live. If you only want them to be able to make changes and not make anything go live, “Edit” level access is fine.

publish, approve, edit, read gtm container

If you set permissions at the account level, you can control the container permissions for all containers in a single place. Here’s an example of a user who has admin access at the account level and can add new users. But only has “Read” access for the multiple containers, meaning this person can’t make any changes to those containers.

gtm account user access

More Google Tag Manager Resources

There’s a lot to learn with Google Tag Manager. If you’ve found this helpful, you might also like these two articles:

Wrapping Up

Looking for something else? Feel free to leave a note in the comments or on the Root and Branch YouTube channel at

About Root & Branch

You can learn more about Root & Branch here. Or hit the button below to check out YouTube for more digital marketing tips and training resources.

click to yt

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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