How to Import a Container Into Google Tag Manager


Shipping Containers

Today we’re highlighting one of Google Tag Manager’s less talked about features – importing a container, which we mentioned in last year’s post about Google Tag Manager’s new look. This tool helps us manage multiple containers, make bulk changes, and import specific tags, triggers, and variables created by others. We’ve broken down the process into simple steps below!

What Is Container Import?

This is a feature in Google Tag Manager that let’s you import a JSON file that contains tags, triggers, and variables into your container. This may be an entire container or just items.

Why Would You Need To Import A Container?

Four common use cases for importing a container are:

  1. You have a lot of sites and want to set up a default container for each of them. For example, imagine a hotel chain that has 100 hotels, each with its own site and container. Would you rather go in and manually create dozens of tags, variables, and triggers from scratch 100 times, or just do that once and import those settings 99 times?
  2. Importing new tags, variables, and triggers that have been shared with you.
  3. Making bulk changes to your container.
  4. You’re maintaining separate GTM containers in different environments, like a dev or staging site, and you want to export out of one environment and into another.

How To Import A Container

Follow the simple steps below to import a container:

1. Log into GTM and navigate to your Account and container.

2. In the top navigation, click through to the Admin

GTM Admin

3. Under the Container options, click on Import Container

GTM Import Container

4. Choose the JSON file that has the container you wish to import. See below for details about how/where to get this file.

GTM Import JSON File

5. Choose to either Overwrite or Merge.

  • Overwriting the existing container will remove all your existing tags, triggers, and variables, and will replace them with those in the imported container. A new container version will be created before the import. Use this option if you want to start fresh with the imported container.
  • Merging containers will let you keep your existing tags, triggers, and variables, and just add in the new ones. If you choose to Merge the new container with your existing container, you’ll have to then decide whether you want to overwrite conflicting tags, or rename conflicting tags.
    • Overwrite – If a variable, tag, or trigger in the new container has the same name but the contents are different, overwrite the old one with the new one.
    • Rename – If a variable, tag, or trigger in the new container has the same name but the contents are different, keep the old one and rename the new one.

6. Click Continue. You’ll see a preview of changes, showing how many tags, triggers, and variables will be added, modified, or deleted. You can also click the link to View Detailed Changes to see which tags, triggers, and variables are being added, modified, or deleted.

GTM Import Changes

7. Once you’re satisfied with the changes, click Confirm.

What If I Don’t See The Import Container Option?

You need to have edit permissions for the container to be able to import. If you don’t have edit permissions, you won’t see this option.

Where Do I Get A Container File?

There are generally two ways to get a container file to import:

  1. Export a container from your GTM account. In the Admin, just beneath the Import Container option, there is also an Export Container option. Clicking on Export Container will let you select a container version, and then it will generate the JSON file needed to import into another container.
  2. Other shared resources. At LunaMetrics, we will start sharing container files for things like YouTube video tracking, AJAX event listening, and more. Check our blog regularly for these resources!

Jim Gianoglio is a Manager for the Analytics & Insight department. He works with implementation, analysis and training of Google Analytics and Google Tag Manager. Before focusing on analytics, he led the SEO campaigns of Fortune 500 companies in the insurance, retail and CPG industries. Things you didn’t know about Jim: he’s biked from Pittsburgh to Washington DC in 41 hours, roasts coffee beans and has done voiceovers for TV commercials.

  • Cole Timm

    Hey Jim, is it only possible to export and import containers within the same account? Meaning, can I not export one container from one account and import into another account?

    • Jim Gianoglio

      Hey Cole –

      This is the beauty of import/export – you are not limited to containers within a single account. You can export a container from account A, and import it into Account B. Or, if we share a container with you, you can import that into whatever account you’d like!

  • Carmen

    Hi Jim, I’ve been trying to import your Scroll Tracking Json file but my GTM says ‘Failed to create a version of the container draft’. Could it be because of its size? what could I do to fix it? Thank you

    • Jim Gianoglio

      Hi Carmen,

      The problem is that as part of the process of importing a container, GTM will first save (or attempt to save) the current draft of your container as a new version. If there are any syntax errors in custom HTML tags or custom JavaSCript variables, or if you have any references to variables that don’t exist, then GTM throws that error that you’re seeing.

      To find out where the problem is, go into you current container and go into Preview and Debug mode. It should pop up an error window telling you exactly what is causing the problem (missing variable, syntax error in code, etc.).

      Once you fix those errors, you’ll be able to import the container.

      Hope that helps!

  • Valerie

    Hi Jim,

    I was wondering what would be the best way to transfer only a set of tags from one container (test) to another container (live) like for instance only conversion tags? In this way, I won’t be adding any duplicate tags of tags that might create issues. Any best practices on this? Thanks in advance!

    • Jim Gianoglio

      Hi Valerie,

      If the only difference between your test container and live container is the additional conversion tags (i.e. all other tags, triggers, and variables between the two containers are the same), then you can just import the entire test container into the live container and choose the “Overwrite” option in step 5.

      Also, you may want to look into a relatively new feature of GTM – Environments:

      Environments let you have the same container on your testing/staging/dev/QA servers as well as your live site. Then you can choose which version of a container to publish to which environment, allowing you to publish the version with your conversion tags (for example) only on your test site, and after testing you can just publish that container version to the live site. No need to export/import containers.

      • Valerie

        Thanks for the great reply! We checked this feature in our company and it can be a great help for our situation: we are currently trying to migrate to UA with GTM although GTM is already implemented on one part of our website (also stil using classic analytics). For the moment we have a test container set-up and a live container (production). This test container has not always been used simultaneously with the live container and is only implemented on our staging pages of course. In order to test our tags first we want to test them on our staging pages before publishing them in our live container.

        We are not sure what would give us the best solution for this migration from test to live website: the environments feature or the use of two containers since we don’t use the test container that frequently. Especially since the chance exists that while migrating the hard-coded tags to the test container (or the new environment) new adjustments may be made in the live container/environment, we are doubting which option is best suited for our situation. Maybe you could give us some clarity on this? Many thanks for your previous fast response!

  • Vladimir Zhelnov

    Hello, how to view scroll tracking in Google Analytics?

  • Scott Piggott

    Hey Jim, thanks for the great article. I successfully imported the container and I can see events firing in preview mode, but the data doesn’t appear to be sent to Google Analytics. If I go to real-time > events in Google Analytics and browse the site in preview mode, the clicks, scrolls, etc appear to be firing, but nothing is showing up in GA. What am I doing wrong?

    • Jim Gianoglio

      Have you published your container yet? Also, check your date range when you’re looking in the standard reports in GA. Make sure you have the current day included (and wait a few hours after you’ve seen the data in the Real-Time reports). If you still don’t see anything, check your View filters to make sure you’re not filtering the hits out.

  • StylishNauticalLivin

    Thanks Jim!!

  • StylishNauticalLivin

    After the test post, let me say, Thank you very much. I am very new to GTM, but I can see it being my best path as a startup in OpenCart. (no boos or hisses please) 🙂 And I have been looking/longing for a container template to set up tracking on my new store. I don’t have a data layer hard coded, but I intend to use the GTM Variable function to create Custom Javascript Variables, in data layer format.

    So, is this the correct approach with the containers you share. Am I still missing something?

    • Jim Gianoglio

      Yeah – importing containers is a great way to get started. Keep in mind, you’ll still have to customize or configure certain parts within the containers you import to be specific to your site, but it still saves a lot of time.

      You can find our shared containers on the Recipes section of our site:

  • StylishNauticalLivin

    Well, it rains and pours GTM at lunametric. So, thanks for the head start.. I found some places to put my ID, and that sort of thing; Still; I was really short on the concepts of GTM telemetry without the hard code data layer. So, more than time saving, the shared container you so graciously provided, has become the Rosetta Stone for me, to understand just how this can work. Good stuff! I left my details in the contact form. I’m ready for the next steps.

Contact Us.

Follow Us



We'll get back to you
in ONE business day.
Our Locations
THE FOUNDRY [map] LunaMetrics

24 S. 18th Street
Suite 100

Pittsburgh, PA 15203


4115 N. Ravenswood
Suite 101
Chicago, IL 60613


2100 Manchester Rd.
Building C, Suite 1750
Wheaton, IL 60187