How to Bulk Delete Google Tag Manager Tags Triggers and more

Disclosure: Please note that this article may contain affiliate links. You can read the full disclosure here.

If you are like me you may have been playing around in Google Tag Manager. The full featured web application by Google to help you manage your website. While playing around or testing things out you may end up adding several different tags, triggers or variables and now you need a quick method to clean it all up.

I first starting using Google Tag Manager last May, when the GDPR rules went into enforcement, so I could control when cookies would be fired and applied to visitors computers. If you are curious about being compliant for GDPR, I highly recommend that you check out Lucrenzia’s GDPR Compliance course., I was a complete wreck at first as I had believed so much hype that was not true. She set me straight and I updated my rules to be less strict – so that all our sites meet the GDPR guidelines, but still can function correctly.

But it is so cumbersome to try to delete tags, triggers, variables – the objects of Google Tag Manager. You have to click into the objects one at a time, click delete, save, then go back to the main screen to click into the next.

I am trying to prepare a generic container with just the basic starter tags so I can share this awesome tool with others who are just learning. Trying to clear out all my site specific items before I found the bulk method took hours.

Then I went to export the container and I noticed and thought to myself “Hey, this is just a JSON file, I bet we can edit this”… I was off and running. My first edit, I must have been too eager, turned out I was missing one comma or maybe a bracket somewhere that was making the new file invalid. My first thought was that I was on the wrong track and that maybe we cannot edit this file afterall.

But, I started over and tried again. This time, testing on the follow JSON validator site: after the first, second, fifth edits and each time coming back valid. Okay. So maybe this is possible.

Namecheap is having a huge Black Friday sale on hosting and domain names
Big Discounts for Domains, Hosting, SSL and more

I tested importing my updated JSON file into Google Tag Manager and low and behold, it was accepted and applied the changes.

I went back to the JSON file and finished deleting the objects I no longer needed and within 10-15 minutes time I had deleted and cleaned up my Tag Manager container and the changes were applied, then imported once more to Google Tag Manager.



Steps to bulk edit Google Tag Manager GTM Tags

  1. First you need to export your current GTM Container
    • Click on Admin tab on the upper menu
    • Screenshot of Step 1 Export GTM Container

    • Choose your Version of Workspace that you want to export
    • Screenshot of Step 2 Choose Version or Workspace

      Screenshot of Step 3 Click the name of the workspace and-or version

    • Lastly click the Export button
    • Step 4 -- Click Export

  2. Make a copy of the downloaded JSON file, add “edit or edited” to the name.
  3. This way you have the original to go back to if something goes wrong.

  4. Right-click on the copy of the downloaded JSON file and open with either Notepad or Notepad++ if you have it installed. I recommend Notepad++ as it will help you to also see the editing order of the current file.
  5. Once open, look over the file to get familiar with the structure. This is important.
  6. Bulk Deleting the Tags, Triggers, Variables and more
  7. The objects all start and end on the same indentation. So in this case if you look at the code for the example tag, delete from the opening bracket (first highlight) to the last bracket (last highlight).

    Screenshot of Example Tag to Delete

    Next copy and paste your code into the html textbox to test your code on the JSON validator, to make sure your code is still valid.

    Screenshot of JSON Validator

    If your file is still valid, then continue on through the JSON file, checking after every few changes again.

    Note: If any tags depend on a specific trigger, you cannot delete the trigger with this method — unless you first clear the dependency on the tag, that may be more complicated. But, play around and test with the validator.

  8. Import back into Google Tag Manager
  9. Now that your changes are done and verified in the validator. Import your edited JSON file into Google Tag Manager.

  10. Open Google Tag Manger
  11. Click on Admin
  12. Click on Import Container
  13. Screenshot of Click Import Container

  14. Make your selections – whether to save to a new workspace or use an existing one.
  15. See the updated changes that will apply

  16. Next is Overwrite or Merge, if you are wanting to modify the current Tags to bulk delete, then most likely you want to overwrite your settings.
  17. Test, Test and Test some more
  18. Now that your updated container is uploaded to Google Tag Manager, test to make sure that the tags are firing. Preview your space and/or test with the Chrome extension Tag Assistant.

Avatar for Tara, WP Blogger Assist

I have over 15 years experience in IT. Over this time: managing server infrastructure, building websites and more. This website is dedicated to helping WordPress bloggers with setting up their blogs and websites; optimizing fast page loading, SEO and social media marketing - such as; Pinterest, Facebook and more.

Leave a Comment