Google Tag Manager
Consentio integration with Google Tag Manager
What is Google Tag Manager
GTM is a container for managing third-party tags. Consentio sends it the Google Consent Mode v2 signals, so tags in GTM can follow the visitor's choice.
Installation
Keep the standard GTM snippet and place the Consentio code above it. Consentio then sends the Consent Mode signals for you.
HTML
<!-- 1. Consentio code first, above GTM (no async) -->
<script src="https://consentio.cz/widget/YOUR_KEY/consentio.min.js"></script>
<!-- 2. Then Google Tag Manager -->
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');
</script>
Tip: The Consentio code must sit above the GTM snippet in the page source. What decides is the order in the HTML, not which script downloads first.
Setting Up Consent in GTM
- Go to Admin → Container Settings → Enable consent overview
- Set the required consent for each tag
- Consentio sends the consent update after the visitor's choice and on every page load with a stored choice
Category Mapping
| Consentio Category | Google Consent Mode Signals |
|---|---|
| analytics | analytics_storage |
| marketing | ad_storage, ad_user_data, ad_personalization |
| functionality | functionality_storage, personalization_storage |
| necessary | none (security_storage is always granted) |
Consent Settings for Individual Tags
analytics_storage— GA4, Hotjar, Microsoft Clarityad_storage— Google Ads, Facebook Pixel, remarketingad_user_data— Sharing user data with advertising platformsad_personalization— Personalised advertisements
Alternative: Manually Blocking GTM
If you do not wish to use Consent Mode, you can block GTM entirely:
HTML
<!-- GTM will only load after consent is granted -->
<script type="text/plain" data-category="analytics">
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');
</script>
Note: This is Basic mode — Google receives nothing before consent, which is the
safest option under ePrivacy. The standard installation above is Advanced mode: GTM runs
immediately and sends anonymous pings before consent that GA4 uses to model conversions.