A GTM container collects dead tags over time, and a bloated container slows the site and hurts INP.
If you want a faster site and a container you can trust, audit what actually fires and delete the rest. A container gets slow because nobody removes anything.
Find the Dead Tags
- Export the container. Go to Admin > Export Container so you have a backup and a full list of tags, triggers and variables.
- Remove what can’t fire. Paused tags, tags with no trigger, and tags on triggers for pages or events that no longer exist.
- Check what does fire. Run Preview on your main page types and conversions. Note every tag that fires and compare it with the list.
- Check where the data goes. A tag can fire and still be dead. Old Universal Analytics tags, pixels for ad accounts that stopped spending, and trial tools nobody logs into.
- Find duplicates. Two GA4 config tags, the same pixel installed by a template and again by Custom HTML.
- Clean up what’s left behind. Delete triggers and variables that no tag uses.
Ask an owner for each remaining tag. If nobody can say who uses the data, pause it for 30 days, then delete it.
Measure GTM’s Effect on INP
The container script itself is small. The cost is what it loads and runs: every Custom HTML tag, every vendor library, and every listener attached to clicks and scrolls runs on the main thread, and that’s what delays interactions.
- Open Chrome DevTools, go to the Performance panel and record while you click around the page.
- Look at the slow interactions and expand the long tasks. Scripts are grouped by domain, so third party tags are easy to see.
- Block
googletagmanager.comunder Network request blocking and record again. The difference is your container. - Re-enable it and pause tags one group at a time in a Preview workspace to find the heavy ones.
The usual causes:
| Cause | Fix |
|---|---|
| Session replay & heatmap tools | Run them on a sample of pages or sessions, not every page view. |
| Chat widgets | Load on click or after a delay, not on page load. |
| Everything firing on All Pages | Limit each tag to the pages that need it, and fire non-critical tags on Window Loaded. |
| Click and scroll listeners | Remove triggers nothing uses. Each one adds work to every interaction. |
Custom HTML with document.write or sync scripts |
Replace with an async version or a template. |
Server-Side Tagging Doesn’t Fix It Alone
Moving to a server container doesn’t make a bloated web container fast. The browser still loads the container and runs the tags that are in it. It only helps when you remove vendor scripts from the browser and send their data from the server instead. If the same pixels still load on the page, nothing changed.
GTM Under a Content Security Policy
A strict CSP blocks GTM until you allow it with a nonce:
- Generate a new nonce on the server for every page load, and send it in the
script-srcdirective. - Add the same nonce to the GTM snippet’s script tag.
- Use the nonce-aware version of the snippet from Google’s CSP guide, which passes the nonce on to the scripts GTM injects. Without it, Custom HTML tags are blocked.
- Add each vendor’s domains to the policy. Every tag in the container needs its own
script-src,img-srcandconnect-srcentries.
Content-Security-Policy: script-src 'nonce-{RANDOM}' https://www.googletagmanager.com; img-src https://www.googletagmanager.com; connect-src https://www.google-analytics.com
Two things catch people out. A cached page serves the same nonce to every visitor, so the nonce has to be generated where the page isn’t cached. And Custom JavaScript variables need 'unsafe-eval', so replace them with built-in variables or custom templates if you can’t allow it.
A CSP is another reason to keep the container small. Every tag you delete is a domain you don’t have to allow.
Keep It Small
- Name everything the same way: platform, type, then detail, like
GA4 - Event - generate_lead. - Use folders by platform or team.
- Write the owner and date in the tag notes.
- Describe every version when you publish, so changes can be traced.
- Audit on a schedule. Twice a year is enough for most sites.
I go into the naming and structure I use in Google Tag Manager patterns.