Import and Export GTM Containers

Google Tag Manager is the great online tag management tool to manage analytics tags, pixels and code snippets to be included on your sites. Setting up containers for different sites and copying tags, triggers and variables between them however is a real pain. To the rescue GTM introduced the container Import and Export feature that allows you to import/export a JSON file that contains tags, triggers and variables.

You can reproduce a container setup by exporting the container and then importing the file into a different container, or you can edit the exported file to include only a subset of the tags, triggers and variables before importing it. By importing and exporting containers, you can create and reuse container templates and share Google Tag Manager implementations with others.

Why do you need to import/export a container?

  • Make bulk changes to tag configurations. For example, you want set up a new site whose structure and tag configuration is similar to an existing site. As an alternative to recreating the container from beginning, export a container from the existing site, and then import the container configuration file into a new container.
  • Import new tags, variables and triggers that have been shared with you.
  • Manage different containers in separate environments, like a staging or pre-production site, and you want to export out of one environment into another.

How to Export and Import Container?

Follow these simple steps below to import and export a container. One needs to have edit permission for the container to be able to import/export. If you don’t have edit permission, you won’t see this option.

To export a container:

1. In Google Tag Manager, navigate to the desired account and container.

2. In the top navigation, go to Admin → Export Container.import-and-export-gtm-containers-13. Select the desired container version from the selector.import-and-export-gtm-containers-24. Preview and confirm your export file and click Download.

To import a container:

1. In Google Tag Manager, navigate to the desired account and container.

2. In the top navigation, go to Admin → Import Container.

3. Select the desired container file using the selector (i.e. the file you downloaded while exporting container).

4. Select Overwrite or Merge.

  • Overwriting: Selecting this will remove or overwrite all your existing triggers, tags and variables, and will replace them with those in the imported container. A new container version will be created before the import.
  • Merge: To merge, select whether you want to overwrite or rename inconsistent or conflicting tags, triggers and variables.
  • Overwrite inconsistent tags, triggers, and variables. Whenever in a new container tag, trigger or variables has the same name but the contents or settings are different, overwrite the old one with the new one. (no conflict If the contents are the same.)
  • Rename conflicting tags, triggers, and variables: if a variable, tag, or trigger in the new container has the same name but the contents are different, rename the new one. (no conflict If the contents are the same.)

5. Click Continue. The summary dialog will show how many tags, triggers and variables will be modified, added, or deleted. To see a list of all the items that will be affected click View Detailed Changes.

6. Once you are ok with the changes that will be made, click Confirm.import-and-export-gtm-containers-3

Final thoughts

Importing and exporting a container file is a great way to share and receive useful containers. Importing a container may be painless process for users who are not familiar with creating tags, triggers and variables by themselves. This makes GTM a powerful tool that has made things a lot easier than they were before.

If you like my articles,