Recently, Tamás Geiger dropped a brilliant little tool: a Google Apps Script that automatically creates annotations in GA4 whenever you publish a new live version of your GTM container.
Simple. Smart. Super helpful — especially if your team ships updates like it’s a sport.
Here’s what the script does (human edition):
– It watches your GTM container for new live versions;
– When it sees a change, it compares it to the previous one;
– If it’s new, it creates an annotation in GA4 with your custom message;
– All done via the Admin API, zero manual clicks required.
How it works (no fluff):
– You’ll need a Google Cloud project with billing turned on (don’t worry, this won’t cost you anything extra);
– Enable Tag Manager API + Google Analytics Admin API;
– Set up the OAuth consent screen with the right scopes;
– Plug in your GTM container IDs and GA4 property IDs;
– Set up a time-based trigger if you want it to run, say, every hour.
Why this actually matters:
Yes, you can add annotations manually in GA4 now. But let’s be honest — if you’ve got multiple projects and deploy changes often, no one’s keeping up with manual logs.
This script turns chaos into context. Spot a weird drop or spike in your reports? Just check the annotations: “Oh right, we pushed a new GTM container at 5:04 PM yesterday. Mystery solved.”
A few caveats to keep in mind:
– GTM & GA APIs have quota limits;
– Google Apps Script runs for max 6 minutes;
– Don’t try to run this across 100 containers unless you enjoy debugging quota errors.
Why this is awesome:
1. GA4 still moves like a cruise ship with a flat tire.
2. The community? More like a fleet of speedboats — fast, sharp, and building what’s actually useful.
3. Tamás didn’t wait around. He built the thing, open-sourced it, and made all our lives better.
If you work with GA4 to BigQuery exports, be sure to check out my SQL cheat sheet.