šŸ”„Black Friday sale is here. Our best offer of the year. šŸ”„

Learn more

About cookies on this site

We use cookies to collect and analyse information on site performance and usage, to provide social media features and to enhance and customise content and advertisements. Learn more

Cookie settings

About cookies on this site

Cookies used on the site are categorized and below you can read about each category and allow or deny some or all of them. Learn more

Necessary

Some cookies are required to provide core functionality. The website won't function properly without these cookies and they are enabled by default and cannot be disabled.

Preferences

Preference cookies enables the web site to remember information to customize how the web site looks or behaves for each user. This may include storing selected currency, region, language or color theme.

Analytical cookies

Analytical cookies help us improve our website by collecting and reporting information on its usage.

Marketing cookies

Marketing cookies are used to track visitors across websites to allow publishers to display relevant and engaging advertisements. By enabling marketing cookies, you grant permission for personalized advertising across various platforms.

  • Courses
    • šŸ”„ BLACK FRIDAY SALE šŸ”„
    • Paid courses
    • Course bundles
    • Free courses
  • Blog
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • Services
  • About
    • About
    • Contact
  • Login
  • Courses
    • šŸ”„ BLACK FRIDAY SALE šŸ”„
    • Paid courses
    • Course bundles
    • Free courses
  • Blog
  • Resources
    • Youtube channel
    • E-books and Guides
    • GTM Recipes
    • View All Resources
    • GTM Community
    • GA4 community
  • Services
  • 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
3 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

Reyan Iqbal
  • Apr 17 2023
  • Reply

Greetings!
I am facing issue regarding to google tag manager containers. I am firing my tag for just one time but three conteiners against i trigger in ga4 are loaded in which tag is firng.
how to resolve this issue?

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
  • Google Tag Manager Server-Side Tagging with Stape
  • Google Ads Conversion Tracking Not Working? Here’s how to fix it
  • Path Exploration report in Google Analytics 4
Analytics Mania - Google Tag Manager and Google Analytics Blog | Privacy Policy
Manage Cookie Settings