Documentation

Everything you need to know for quick Consentio implementation

Google Tag Manager

Consentio integration with Google Tag Manager

What is Google Tag Manager

GTM is a container for managing third-party tags. Consentio automatically sets up Google Consent Mode v2, so GTM respects the user's preferences.

Installation

Use the standard GTM installation. Consentio sets up Consent Mode automatically.

HTML
<!-- 1. Consentio first (no async — must run before GTM) -->
<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: Make sure the Consentio script is loaded BEFORE the GTM script.

Setting Up Consent in GTM

  1. Go to Admin → Container Settings → Enable consent overview
  2. Set the required consent for each tag
  3. Consentio automatically updates Google Consent Mode

Category Mapping

Consentio Category Google Consent Mode Signals
analytics analytics_storage
marketing ad_storage, ad_user_data, ad_personalization
functionality personalization_storage
necessary functionality_storage, security_storage

Consent Settings for Individual Tags

  • analytics_storage — GA4, Hotjar, Microsoft Clarity
  • ad_storage — Google Ads, Facebook Pixel, remarketing
  • ad_user_data — Sharing user data with advertising platforms
  • ad_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>
Warning: Manually blocking GTM is not recommended. With Consent Mode, GTM works correctly and can collect anonymised data even without consent.
Custom WebsiteGoogle Analytics