Cookiebot + GTM
Cookiebot + GTM loads
Cookiebot and
Google Tag Manager on the
same page in the order Google requires, so GTM-managed tags only fire
after the visitor has consented through the Cookiebot banner.
Create a Cookiebot profile and a GTM container, paste their IDs on the
configuration page, and the module takes care of the script tags, the
<noscript> iframe, Google Consent Mode defaults and a
/cookie-declaration page rendered from your Cookiebot
profile.
Features
- Correct loading order – Google Tag Manager
is attached before the Cookiebot script, so Cookiebot can block or
allow GTM tags once consent is known. - Google Consent Mode support – Optional
gtag("consent", "default", ...)tag with per-category
defaults (ad personalization, ad storage, ad user data, analytics,
functionality, personalization), updated by Cookiebot as the visitor
chooses. - Multilingual – Optional language-specific
Cookiebot banner, and a GTM container ID per language with a
fall-back to the general ID for languages added later. - Server-side tagging – Configure a custom GTM
hostname so the loader points at your tagging server. - GTM environments – Optional environment ID
and token for loading a non-live GTM environment on staging sites. - Cookie declaration page – Ready-made
/cookie-declarationroute that embeds Cookiebot's
hosted declaration based on your CBID. - Admin-aware – The scripts and the noscript
iframe are suppressed on admin routes so GTM does not track the
editorial workflow.
Why use this module?
Loading GTM and a Consent Management Platform together is easy to get
wrong: the script order determines whether Consent Mode works at all,
the noscript iframe needs the same visibility rules as the script, and
server-side tagging and GTM environments add parameters that have to
land in both tags. This module encodes those decisions once and exposes
only the fields you actually need to fill in.
Comparison with related modules
| Module | Approach | Best for |
|---|---|---|
| Cookiebot + GTM | Loads Cookiebot and GTM together, in the right order, with Consent Mode defaults and a cookie-declaration page. |
Sites that use Cookiebot as their CMP and want GTM to respect it out of the box. |
| Google Tag | Dedicated Google Tag Manager / Google tag integration with container, snippet and insertion-condition management. |
Projects that only need GTM and handle consent elsewhere (or not at all). |
| EU Cookie Compliance | Self-hosted cookie banner with per-category consent, rendered by Drupal itself – no third-party CMP account required. |
Sites that prefer to keep consent in-house rather than relying on a hosted CMP. |
| Klaro | Integrates the open-source Klaro! consent manager, with per-service consent and script blocking driven from Drupal configuration. |
Teams that want an open-source CMP with per-service control and self-hosting. |
| COOKiES Consent Management | Modular consent manager with its own service and UI plugins, and dedicated sub-modules for Google Tag Manager, Matomo and others. |
Projects that want a plugin-based CMP and are not tied to Cookiebot. |
| Cookie Content Blocker | Blocks embedded third-party content (YouTube, Twitter, …) in rendered output until the visitor accepts cookies. |
Complementary – use alongside Cookiebot + GTM to cover inline embeds that GTM does not inject. |
💪 Built by humans
This module is built by humans maintained with the help of AI assistants for code generation, review, testing, and documentation. All code is carefully
reviewed by the maintainers to ensure that quality and security
standards are met.
Requirements
- A Cookiebot account with a
Domain Group ID (CBID). - A Google Tag Manager
account with a container ID (GTM-XXXXXXXX).
Project information
Maintenance fixes only
Considered feature-complete by its maintainers.- Project categories: Integrations, Search engine optimization (SEO), Site search
- Ecosystem: Cookiebot - Cookie consent, Cookie monitoring and Cookie control
171 sites report using this module
- Created by fabianderijk on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.







