The Measurement Room
Simo Ahava's Consent Mode template for Google Tag Manager
The community-gallery GTM template for Google Consent Mode, adjusting tag behaviour from the visitor's recorded consent state.
Google Consent Mode lets tags adjust behaviour, cookieless pings instead of full tags, for example, based on a visitor's recorded consent rather than firing or blocking wholesale. Wiring it correctly by hand is fiddly: default states, update events, and region-specific rules all have to line up before any tag fires. Simo Ahava's Consent Mode template packages that logic as a GTM tag, available in the Community Template Gallery.
Why it made the cut
Simo Ahava is one of the most cited educators in the tag-management field, and this template is about as close to a canonical Consent Mode implementation as exists outside Google's own documentation. It is installable straight from GTM's gallery rather than pasted in as custom HTML, which keeps the container easier to audit and maintain.
How to run it
- In GTM, open the Templates section and search the Community Template Gallery for "Consent Mode" by Simo Ahava.
- Add the template, then create a tag from it, setting default and updated consent states to match your consent management platform's categories.
- Fire the default-state tag on Consent Initialization, and the update tag on whatever event your consent platform pushes when a visitor changes their choice.
- Test with GTM's preview mode and the browser's network tab to confirm
gcsand related consent parameters change correctly before and after consent.
Worth knowing
The template implements Consent Mode's mechanics correctly, but it does not decide your consent categories or legal basis for you, that mapping is still yours to get right, and a mismatch there will silently misclassify visitors regardless of how well the template runs. It also assumes a consent platform that writes a readable signal GTM can pick up, so it is not a complete solution without one.