How to Optimize the Use of Google Tag Manager with Export/Import of Containers

Steps to Import Containers in GTM

Google Tag Manager (GTM) helps marketing managers or webmasters launch programs faster by deploying tags that send information to a third party, such as Google, instead of having to maintain the code snippets in the source files. So, it enables you to deploy tags to your website or app in a way that optimizes your marketing campaigns and traffic analysis. The simple interface of GTM thus reduces the difficulty of adding tags to websites or apps.

But, there is more to GTM that makes tag management fairly simple, namely the fact that GTM supports reusability to a great extent.

How does GTM encourage reusability?

Well, consider the following scenario: you wish to set up a website with its structure and tag configuration being identical to one of your existing sites. If only a few details, such as the domain names and conversion IDs, are different, then you need not spend time creating the container from scratch. Instead, you can export the container of your existing site, change the relevant parameters with a text editor, and import the modified configuration file into a different container for your new website.

Such a level of reusability is possible with GTM because it deals with containers, which are sets of tags, triggers, and variables. Ideally, you would want to have one container for every website or mobile app that you own and the reusability is made possible by the import or export of these containers.

In this article, we will go through the steps required to import and export containers in GTM.

Overview of Container Reuse in GTM

You can migrate content between containers through the import or export of containers in GTM. Such an implementation empowers you to reuse tags, triggers, and variables within the GTM containers. So, the export and import of containers allows you to create and reuse container templates and even share GTM implementations with others.

The basic premise is that you export a container as a JSON text file, consisting of triggers, tags, and variables. You can then import the file into a new container, with or without any modifications. In fact, the exported containers can easily be modified, compared, shared or stored in a version control system and imported into GTM.

Prerequisites

Before you can start using the import or export feature, you need to have your own GTM account, which will consist of all your containers.

Example

If you have a website and a corresponding Android app as well as an iOS app, then your Tag Manager account can have three containers which are set up. Clearly, there is one container for each web property or app. Additionally, you will need a new container for every major version of your mobile app.

Import and Export of Containers

Steps to Export Containers in GTM

  • Log in to your GTM account.
  • Choose the container you intend to export from the accounts page.how-to-optimize-1
  • Navigate to Admin -> Export Container.how-to-optimize-2
  • Select the desired version or workspace of the container.how-to-optimize-5
  • Preview and confirm the export file with a click on “Export”.how-to-optimize-3

Steps to Import Containers in GTM

  • Log in to your GTM account and select the desired container to import.
  • Navigate to Admin -> Import Container. If you do not see the “Import Container” option, it is likely that you do not have edit access to the container.
  • Choose between creating a new workspace or using an existing one.how-to-optimize-4
  • Select “Overwrite” or “Merge” as your import option. The “Overwrite” function will delete all your existing tags, variables, and triggers and replace them with the ones in your imported container. The result will be a new container version before the import. You can apply the “Merge” function if you intend to combine the existing container with some additional parameters. Here, you can choose to overwrite or rename the conflicting tags, triggers, and variables. For example, if a tag in the new container has the same name, but different content, then you can overwrite the old one with the new one. Similarly, you can rename the new one in case of a conflicting tag, trigger or variable.
  • Click “Continue” to proceed further and the preview dialog will show the number of triggers, tags or variables that have been modified, deleted or added.
  • Click on “View Detailed Changes” to get a complete list of all the items that will be affected or changed.
  • Once you are done, click on “Confirm”.

Examples of Using Export or Import for Containers

Clearly, the export and import of containers allows you to create reusable tags and establish the best practices for GTM. In fact, you may even use some highly effective tags made by other experts. Thus, you need not be too familiar with the process of creating tags, triggers, and variables on your own.

The following are typical ways to use the export and import container feature:

Carry Out Bulk Changes to Tag Configurations

This method allows you to quickly create a new site, with the identical structure and tag configuration of an existing site, by replacing some information in the exported file.

Preserve All Website Configuration Data in a Central Location

You may at times need to store all your container versions in a version control system to review the changes before they go live. If you use tools like git and diff, then exporting or importing containers would help you store all the configuration data in a central location.

Thus, the export and import of containers equips you with the ability to reuse different tags, triggers or variables. In this way, it saves you a lot of time and effort which can be used for other GTM activities.

We hope the information shared here with regard to reusing the containers in GTM proves valuable to you. Feel free to share your suggestions or feedback in the comments section below.

 

If you like my articles,