Integrations
Google Tag ManagerGoogle Tag Manager
preset documentationDocumentation

GTM and CookiePilot: Consent Initialization, dataLayer and required consent

Use GTM as the deployment layer, but do not let tags start before the user's choice. CookiePilot publishes consent updates to the dataLayer and GTM rules start vendors only after the right consent.

Consent behaviour

Layer: installation and tag orchestration.

Event: cookiepilot_consent_update.

Most important: stub before other tags.

Setup steps

Add the stub before GTM.

Add the CookiePilot tag on Consent Initialization.

Set required consent on vendor tags.

Example snippet

Example snippet
cookiepilot_consent_update

function () {
  var consent = window.cookiepilot_consent || {};
  return consent.marketing === true;
}

Test checklist

Preview shows the CookiePilot tag first.

Consent state starts as denied.

Vendors wait for the consent update.

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.