• Courses
    • Courses
    • Course bundles
  • Blog
  • Services
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • About
    • About
    • Contact
  • Login
  • Courses
    • Courses
    • Course bundles
  • Blog
  • Services
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • About
    • About
    • Contact
  • Login

February 1, 2021

How To Clear Google Tag Manager Container

Update: February 1st, 2021

GTM now allows to do bulk changes (e.g. delete multiple tags, triggers, or variables at once). Learn more here

======

Have you ever been in a situation when you need to remove all tags, triggers, and variables from GTM container? I have. Sometimes creating a new container from scratch isn’t an option, because you might need to keep the current container ID.

Unfortunately, GTM does not offer an easy way to push the button “Clear container” and start over. What about manually deleting everything (on by one)? Nobody has time for that! In this blog post, I’ll show you two easy options on how to clear Google Tag Manager container.

 

Why is that a problem at all?

Why is manual purge not an option? It’s time-consuming. If you have 50 tags, 50 triggers, and 50 variables, you’ll need to hit the Delete button 150 times.

Google Tag Manager Gif Funny

Why can’t you just create a new container and start working with it, then? In some situations, that’s not an option either.

Imagine that you work in a large company with multiple websites. You asked developers to add GTM container to a particular website but due to corporate structure of your company it took them 3 weeks to install Tag Manager’s code.

If you told them to replace old GTM code with the new one – that’s another 2-3 weeks to wait! That’s frustrating. Even manual deletion of tags sounds like a better solution.

 

 

So What Options Do We Have?

  1. Manual deletion of tags, triggers, and variables – one by one. Not recommended. I won’t explain this option because it’s terrible. You are more intelligent than that. I bet that your reluctance to do the job manually drove you to read this blog post in the first place, right?
  2. Restoring the 1st version of the container. This solution is not universal and works under one circumstance.
  3. Importing an empty container. This is the most recommended solution. I have prepared a simple GTM recipe for that.

Continue reading for a more detailed explanation.

 

Restore Container To The 1st Version

When someone asked me what’s the easiest way to clear the Google Tag Manager container, my first thought came to utilizing Versions.

Just navigate to Versions in the GTM menu.

Version Menu in Google Tag Manager

Find Version 1 and Set it as Latest Version.

Google Tag Manager Versions

This will reset your GTM container’s settings to the very first version. Sounds good.

However, there’s one but.

If your 1st published container version wasn’t empty (i.e. it contained some tags, etc.), these tags, triggers, and variables will be restored.

In other words, this container cleansing method works only if your first published version of the GTM container was empty and did not contain any tags, triggers or variables.

I have just checked several containers of mine in random projects. In some of them, I had published Version 1 empty, in others – 1st Version already contained at least 5 tags. The ratio of empty vs customized containers is approx. 1:1.

To sum up, about 50% of my containers do not support this method of purge. But that’s not a problem at all since I’ve got a backup plan.

 

Import An Empty Container

This method works 100% and is fairly simple. Download this Google Tag Manager Recipe (which includes an empty container) and follow the instructions.

DOWNLOAD EMPTY CONTAINER FOR GTM

Log into your own Google Tag Manager container and head to the Admin section of the site. Under Container options, select Import Container. Read this blog for more details about importing a container file.

Important – make sure you choose the “Overwrite” import option. This will delete all current tags, triggers, and variables in your Google Tag Manager container and replace them with my empty container template.

Overwrite Google Tag Manager container

As a result, your container will contain no tags, triggers or user-defined variables. The only ones that remain are:

  • Event,
  • Page Hostname,
  • Page Path,
  • Page URL,
  • Referrer.

 

Conclusion

GTM does not offer an easy 1-click option to clear the container. Manual deletion is really time consuming and frustrating.

In this blog post, I have described two options for how you can clear the Google Tag Manager container in a blink of an eye. My personal favorite is the import of empty container, since it’s universal and can be applied to any GTM account.

Do you know any other efficient ways how to clear Google Tag Manager container? If yes, let me know in the comments.

Julius Fedorovicius
In Google Tag Manager Recipes Google Tag Manager Tips
2 COMMENTS
Jiten
  • Dec 19 2018
  • Reply

Thanks Julius

Frank Rood
  • May 20 2021
  • Reply

Hi Julius,
I had a problem with Google Tag Manager and just applied your great hack to load an empty container. Worked great. Thank you very much!
Frank

Leave a comment Cancel reply

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

 

Hi, I'm Julius Fedorovicius and I'm here to help you learn Google Tag Manager and Google Analytics. Join thousands of other digital marketers and digital analysts in this exciting journey. Read more
Analytics Mania
  • Google Tag Manager Courses
  • Google Tag Manager Recipes
  • Google Tag Manager Resources
  • Google Tag Manager Community
  • Login to courses
Follow Analytics Mania
  • Subscribe to newsletter
Recent Posts
  • Introduction to Google Tag Manager Server-side Tagging
  • 3 Ways to Pull Data from Data Layer with Google Tag Manager
  • Cannot See the Google Tag Manager Option in Google Ads Conversion?
Analytics Mania - Google Tag Manager and Google Analytics Blog | Privacy Policy
Manage Cookie Settings