GtmCleaner Tool – a free tool to standardize your containers naming

GtmCleaner Tool

Good news everyone.. Recently GtmCleaner Tool has become a finalist of the UK Digital Growth Awards 2022 in the category «BEST TRACKING TECHNOLOGY». If the guys from UK Digital Growth Awards have given the tool a try, I hope you could also give it a try.

The idea of the tool belongs to Phil Pearce, the experienced analyst and owner of MeasureMind Group agency. In his agency, the first step for each new client is cleaning the mess inside the client’s GTM containers. Based on his experience and Google’s best practices, he crafted a list of naming rules. But renaming by hand is a waste of time, and such routine tasks are better left for the algorithms. That’s why he decided to create this tool and make it free to help the community to be more productive and spend web analysts’ time on more complicated challenges.

The short list of rules for tags:

Tag typeTag prefix
GA4 ConfigGA4 pageview - {old_name}
GA4 EventGA4 event - {old_name}
GA3 TRACK_PAGEVIEWUA pageview - {old_name}
GA3 TRACK_EVENTUA event - {old_name}
GA3 TRACK_TRANSACTIONUA transaction - {old_name}
GA3 EEUA event - EE - {old_name}
Google Ads RemarketingGoogle Ads Remarketing - {old_name}
Google Ads ConversionGoogle Ads Conversion - {old_name}
Microsoft ecommerceBing event - ecommerce - {old_name}
Microsoft PAGE_LOADBing pageview - {old_name}
Community templatesTemplate - {template_name} - {old_name}
Paused tags of any typez_{old_name}
htmlHTML - {old_name}
imgImage - {old_name}
optGoogle Optimize - {old_name}
awccGoogle Ads Call Tracking - {old_name}

And so on more than 700 rules for tags, trigger and variables.

The tool has a lite and a pro version. In the lite version you can pass exported json containers and the tool cleans everything in a few seconds, and returns you back a shiny and polished version of the container.

The pro version will ask you to grant access to your GTM, and do cleaning using GTM API, this way you don’t have to export / import containers. But GTM API has a very strict limit of 60 requests per minute (and that’s an extended value) - you have to wait a bit longer, but no manual work is required at all. And yes, the cleaning is totally safe as the tool will create a new Workspace and you can commit changes only you want to.

But the Pro version of the tool not only does the cleaning, it also can:

  • Delete all paused tags - to reduce the container size;
  • Set once per page property for all tags - for most tags it should be default behavior, that’s why the tool option can set this property for all tags, and you can uncheck it for a few tags that really need to be fired once per event;
  • Add 18 auto events tags, and all needed variables and triggers for them. This feature is great material for the other post but in short the feature lets you track clicks to - mailto links, download links, inside google map, youtube or vimeo, outbound links, tap to calls and more. This feature can speed up advance tracking setup for new or existing clients

And at the end, here’s a few words about which technologies were used to build this app. The code is written in Python as a FastAPI application. All GTM related tasks are completed using my open source gtm-gear library. The app is deployed on Google AppEngine. However, the cleaning tasks can take a lot of time because of GTM API rate limits, and that’s why the tool uses Google Cloud Tasks to queue all requests and Firestore to keep the state.

It was very fun and interesting to build the tool. I hope you will enjoy using it. If you have any questions regarding the tool or if you need some GTM or GA automation, please message me on LinkedIn.