Google Tag Manager
A Custom HTML tag with the snippet, fired on Consent Initialization.
Steps
- In Tag Manager, create a Custom HTML tag and paste the snippet into it.
- Set its trigger to Consent Initialization — All Pages, so it runs before every other tag.
- Our own template, CMPStack Consent Banner, is not in the Community Template Gallery yet. Once it is listed it replaces this tag: add it from Templates → Search Gallery, paste the Site ID, and use the same trigger.
- Publish the container, verify the domain in the panel, then publish a banner.
“The Site ID” is your domain’s identifier, shown under Domains → Install tag in the panel.
Snippet for a Custom HTML tag
<script>
window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments)}
gtag('consent','default',{ad_storage:'denied',ad_user_data:'denied',ad_personalization:'denied',analytics_storage:'denied',wait_for_update:500});
</script>
<script async src="https://cdn.cmpstack.io/cmpstack.js?site=YOUR-SITE-ID&api=https%3A%2F%2Fapi.cmpstack.io"></script>Here the Site ID is in the tag’s own address rather than in a data-site attribute. Tag Manager rebuilds the element and does not keep those attributes, so the attribute form would arrive with no Site ID.
Replace YOUR-SITE-ID with your Site ID, or copy the snippet from the panel, where it is already filled in.
The Consent Mode default
The first block sets Google Consent Mode to denied before anything loads — so if our tag ever cannot be fetched, your Google tags stay off rather than firing as if no banner existed.
On a Custom HTML tag the snippet carries the denied default itself, so fire it on Consent Initialization — All Pages. The CMPStack template, once listed, sets the same default when it fires on that trigger.
It protects Google tags only. Meta, TikTok and other tags read no Consent Mode signal; our tag blocks those itself.
Other routesPaste the snippetWordPressShopifyWix