Integrations
Google Tag ManagerGoogle Tag Manager
field-testedPlatforms and stores

Consent Mode v2 in Google Tag Manager without trackers before consent

Deploy CookiePilot through Google Tag Manager so Consent Mode starts before tags and GA4, Google Ads, Meta Pixel and other tools wait for user consent.

Overview

Deploy CookiePilot through Google Tag Manager so Consent Mode starts before tags and GA4, Google Ads, Meta Pixel and other tools wait for user consent.

Result

Consent Mode defaults are set synchronously to denied.

Trace

The main CookiePilot script is loaded through GTM in the configured tag.

Trace

cookiepilot_consent_update is available for triggers and tags.

Consent behaviour

gcd shows denied before the visitor clicks.

After Reject, marketing tags do not start.

After Accept, dataLayer contains consent update granted.

Hardcoded scripts outside GTM are removed or moved behind the CMP.

Setup steps

Paste the CookiePilot stub in head before the standard GTM snippet.

Add cookiepilot.js as Custom HTML on Consent Initialization - All Pages.

Make marketing tags consent-aware or trigger them after cookiepilot_consent_update.

Use Preview to confirm no ad requests or tracking cookies appear before consent.

Example snippet

Example snippet

Example snippet
<script src="https://cdn.cookiepilot.io/stub.js"></script>
<!-- GTM container follows -->
<script src="https://cdn.cookiepilot.io/cookiepilot.js" data-cpkey="YOUR_API_KEY"></script>

Test checklist

gcd shows denied before the visitor clicks.

After Reject, marketing tags do not start.

After Accept, dataLayer contains consent update granted.

Hardcoded scripts outside GTM are removed or moved behind the CMP.

Setup steps

  1. 1Paste the CookiePilot stub in head before the standard GTM snippet.
  2. 2Add cookiepilot.js as Custom HTML on Consent Initialization - All Pages.
  3. 3Make marketing tags consent-aware or trigger them after cookiepilot_consent_update.
  4. 4Use Preview to confirm no ad requests or tracking cookies appear before consent.

Example snippet

<script src="https://cdn.cookiepilot.io/stub.js"></script>
<!-- GTM container follows -->
<script src="https://cdn.cookiepilot.io/cookiepilot.js" data-cpkey="YOUR_API_KEY"></script>

Test checklist

  • gcd shows denied before the visitor clicks.
  • After Reject, marketing tags do not start.
  • After Accept, dataLayer contains consent update granted.
  • Hardcoded scripts outside GTM are removed or moved behind the CMP.

FAQ

Is this legal advice?

No. It is an implementation guide. For unusual data flows, confirm the setup with your legal or privacy team.

Does CookiePilot block every script automatically?

CookiePilot supports autoblocking and Consent Mode. Trackers hardcoded before the CMP still need to be moved behind the stub or into GTM Consent Initialization.

Related integrations

See the setups that most often appear together with this integration.

Ready to configure it?

Start CookiePilot, choose the right integration and verify that tags wait for user consent before they run.