Importing and Exporting Container Files in Google Tag Manager

What is the ‘export container’ feature in Google Tag Manager?

Through the ‘export container’ feature, you can export a container file to your GTM account.

A container file is a JSON file (a file with the extension .json). This file can contain certain or all tags, triggers, and variables you want to import.

When the container file contains a certain number and type of tags, triggers, and variables for a particular type of tracking then it is called Google Tag Manager recipe.

What is the advantage of using the export container feature in GTM?

Through the export container feature, you can share your GTM configurations (aka tags, triggers, and variables) with any third-party.

That means if you want to share your GTM configurations for video tracking with a third-party or another website, you can do that via the GTM export container feature.

If you want to share the GTM configurations of your entire container with a third-party or another website, you can do that via the GTM export container feature.

If you want to share a particular container version or workspace, you can do that via the GTM export container feature. The GTM export container feature is basically the equivalent to downloading a particular container version or workspace.

If you want to take a backup of a particular container version or workspace then use the export container feature.

Get weekly practical tips on GA4 and/or BigQuery to accurately track and read your analytics data.

 

How to export a workspace in Google Tag Manager

Follow the steps below:

Step-1: Login to your GTM account and then click on the ‘Admin’ Tab:

gtm admin tab

Step-2: Click on ‘Export Container’ link under the ‘Container’ column:

export container link

Step-3: Click on ‘Choose a version or workspace’ button:

choose version workspace

Step-4: Select the workspace, you want to export:

select workspace
export button

Step-5: Click on the ‘Export’ button. You should now see a dialog box which gives you the option to either open the exported workspace JSON file or save the file to your hard disk:

save workspace container file

Note: The exported/downloaded GTM workspace file will have a name like the one below: GTM-MQ98JW_workspace32.json

Step-6: Select the ‘Save File’ option and then click on the ‘ok’ button. Once you do that, the exported JSON file will store on your computer hard disk.

Step-7: Click on the ‘Cancel’ button to close the ‘Export Container’ feature:

close export container

Follow the steps below:

Step-1: Login to your GTM account and then click on the ‘Admin’ Tab.

Step-2: Click on the ‘Export Container’ link under the ‘Container’ column.

Step-3: Click on ‘Choose a version or workspace’ button.

Step-4: Select the container version, you want to export:

select container version

Step-5: Click on the ‘Export’ button. You should now see a dialog box which gives you the option to either open the exported container JSON file or save the file to your hard disk:

save container version file

Note: The exported/downloaded GTM container file will have a name like the one below: GTM-MQ98JW_v51.json

Step-6: Select the ‘Save File’ option and then click on the ‘ok’ button. Once you do that, the exported JSON file will store on your computer hard disk.

Step-7: Click on the ‘Cancel’ button to close the ‘Export Container’ feature.

What is the container file and where can you get one?

A container file is a JSON text file (a file with the extension .json). This file can contain certain or all tags, triggers, and variables you want to import.

There are two types of container files:

#1 Workspace container file – This file contains all the tags, triggers, and variables used in a particular workspace. By default, GTM includes the word ‘workspace’ in the filename of a workspace container file. For example GTM-MQ98JW_workspace32.json

#2 Version Container file – This file contains all the tags, triggers, and variables used in a particular container version. By default, GTM includes the version number in the filename of a Version container file. For example GTM-MQ98JW_v51.json

There are two ways through which you can get a container file to import:

#1 You export a workspace or a container version via the ‘export container’ feature.

#2 You used the exported container file shared with you by a third party.

What is the import container feature in Google Tag Manager?

Through the import container feature, you can import a container file (workspace or version file) to your GTM account.

When the container file contains a certain number and type of tags, triggers, and variables for a particular type of tracking then it is called Google Tag Manager recipe.

What is the advantage of using the import container feature in GTM?

Through the import container feature, you can set up dozens of tags, triggers, and variables in a container tag in one go.

This can come in handy when you need to set up the same/similar tags, triggers, and variables over and over again for multiple websites.

Without using the import container feature, you would have to manually set up each tag and its corresponding triggers and variables, and that too over and over again for each website.

Through the import container feature, you can share your GTM configurations (aka tags, triggers, and variables) with any third party or website.

If you want to share your GTM configurations for video tracking with a third party, you can do that via the GTM import container feature.

What you actually import through the import container feature is the container file (in JSON file format) so you need to have a container file ready before you start your import.

Import container options

You can import a container file either to a new workspace or to an existing workspace:

choose workspace

When importing a container file, GTM gives you the option to either merge the imported content with the selected workspace or completely overwrite the workspace:

overwrite merge

Overwrite Import Option

Overwriting the selected workspace will remove all your existing tags, triggers, and variables in that workspace, and will replace them with the content of the imported container file.

A new container version will be created before the import.

Use the ‘overwrite’ option only if you want to start fresh with the imported container.

Merge Import Option

Merging container files will allow you to keep your existing GTM configurations and just add in the new ones.

Before you merge the new container file with your existing container file, you would need to decide whether you want to:

# Overwrite conflicting tags, triggers, and variables.

# Rename conflicting tags, triggers, and variables.

merge import option

A conflicting tag is the tag which carry same name as the imported tag but its contents are different.

A conflicting trigger is the trigger which carry same name as the imported trigger but its contents are different.

Similarly, a conflicting variable is the variable which carry same name as the imported variable but its contents are different.

Note: A tag is not considered a conflicting tag if it carries the same name as the imported tag and its contents are also the same to the contents of the imported tag. The same holds true for triggers and variables.

Select ‘Overwrite conflicting tags, triggers, and variables‘ merge option, if you want to overwrite the conflicting tags, triggers, and variables in the selected workspace with their corresponding imported tag, triggers, and variables.

Select ‘Rename conflicting tags, triggers, and variables:’ merge option, if you want to rename the conflicting tags, triggers, and variables in the new container version.

How to import a container in Google Tag Manager

Follow the steps below:

Step-1: Login to your GTM account and then click on the ‘Admin’ Tab

Step-2: Click on ‘Import Container’ link under the ‘Container’ column:

import container link

Step-3: Click on ‘Choose Container File’ button to select the container file to import:

choose container file button

Step-4: Select new or existing workspace:

import container choose workspace

Click on ‘New’ button if your existing container is not empty. Otherwise, click on the ‘Existing’ button:

If you click on the ‘New’ button, you would be asked to name the new workspace.

If you click on the ‘Existing’ button, you would be asked to select an existing workspace.

Let us suppose you clicked on the ‘Existing’ button and selected the default workspace. Your screen should now look, like the one below:

import container

Step-5: Select your import option: ‘Overwrite’ or ‘Merge’:

choose import option

Step-6: Preview and confirm your import:

preview and confirm your import

From the screenshot above, we can conclude the following:

#1 We are going to import 54 new tags.

#2 We are going to import 57 new triggers.

#3 We are going to import 98 new variables.

Click on the ‘View detailed Changes’ link to get more details about the new tags, triggers, and variables that you are going to import:

view detailed changes

Step-7: Click on the ‘Confirm’ button.

How to import a GTM Recipe

If you want to import a GTM recipe then you should either:

#1 Import the shared container file to a new workspace and then select the ‘overwrite’ option (Recommended)

#2 Import the shared container file to an existing workspace and then merge the selected workspace with the content of the imported container file.

If you used the ‘overwrite’ option while importing a GTM recipe to an existing workspace then all your existing tags, triggers and variables in the selected workspace will be deleted and replaced by the contents of the shared imported container:

view detailed changes2

Because of this, you could end up losing all your current work so be very careful, how you choose to import a GTM recipe.

Related Articles

My best selling books on Digital Analytics and Conversion Optimization

Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.

Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.

Attribution Modelling in Google Analytics and BeyondSECOND EDITION OUT NOW!
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.

Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.

About the Author

Himanshu Sharma

  • Founder, OptimizeSmart.com
  • Over 15 years of experience in digital analytics and marketing
  • Author of four best-selling books on digital analytics and conversion optimization
  • Nominated for Digital Analytics Association Awards for Excellence
  • Runs one of the most popular blogs in the world on digital analytics
  • Consultant to countless small and big businesses over the decade