March 16, 2017
How To Clear Google Tag Manager Container
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 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 Delete button 150 times.
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?
- 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?
- Restoring the 1st version of the container. This solution is not universal and works under one circumstance.
- Importing an empty container. This is the most recommended solution. I have prepared a simple GTM recipe for that.
Continue reading for more detailed explanation.
Restore Container To The 1st Version
When someone asked me what’s the easiest way to clear Google Tag Manager container, my first thought came to utilizing Versions.
Just navigate to Versions in GTM menu.
Find Version 1 and Set it as Latest Version.
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 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 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.
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 post by Lunametrics for more details about importing a container file.
Important – make sure you choose “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.
As a result your container will contain no tags, triggers or user-defined variables. The only ones that remain are:
- Page Hostname,
- Page Path,
- Page URL,
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 how you can clear 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.