Skip to documentation content

What is CookieBeam

A technical overview of CookieBeam's architecture, from the browser runtime and script blocking to the scanner, dashboard, and compliance integrations.

Last updated:

CookieBeam is a consent management platform (CMP). It shows a consent banner on your website, blocks scripts and cookies until the visitor makes a choice, records that choice, and feeds it to the integrations your analytics and ad stack expect. The entire runtime runs in the browser. Your server never needs to talk to CookieBeam's servers for the banner to work.

The runtime

The banner is a JavaScript bundle hosted on CookieBeam's CDN. You load it with a single script tag:

<script src="https://cdn.cookiebeam.com/banner/PUBLIC_BANNER_ID/default/loader.js" data-cfasync="false" data-no-optimize="1" data-no-defer="1" data-no-minify="1" data-noptimize="1" nowprocket="1" data-pagespeed-no-defer="1"></script>

The loader fetches the banner configuration (your categories, translations, regional rules, and appearance settings) and the core runtime. Together they render the consent modal, enforce blocking, and persist the visitor's choice in a cookie.

The tag must be synchronous and first in <head>. It needs to run before any script it might block. See Install the script tag for the details.

What it does on a page

On a page load, the runtime:

  1. Reads the consent cookie, if one exists from a previous visit.
  2. Checks the visitor's location against your regional rules and picks the consent model (opt-in, opt-out, or notice).
  3. Shows or hides the banner based on the model and the visitor's existing choice.
  4. Blocks scripts and iframes that belong to non-consented categories by rewriting their type or src attributes. When the visitor consents, it restores them.
  5. Writes the consent record to a first-party cookie on your domain.
  6. Fires Google Consent Mode v2 signals so Google tags respect the choice without extra code.
  7. If IAB frameworks are enabled, builds and exposes the TC string and GPP string through the standard APIs that ad-tech vendors call.

None of this requires your server to participate. Your server can read the consent cookie if it needs to gate server-rendered content (see Read consent on your server), but the banner itself is self-contained.

CookieBeam supports three consent models. You pick one globally and override it per region with regional rules.

ModelBehaviorTypical use
Opt-inOptional categories start blocked. The visitor must actively accept before scripts in those categories run.GDPR, UK GDPR, LGPD, PIPEDA
Opt-outCategories marked enabled start granted and their scripts run immediately. The visitor can opt out to revoke them.US state privacy laws (CCPA, CPA, CTDPA, etc.)
NoticeAll categories are active. The banner informs the visitor but doesn't gate anything.Jurisdictions with no blocking requirement

Each model changes the banner's buttons, the default state of categories, and what the runtime writes to the consent cookie. See Consent model for the full picture.

Categories

Every script, cookie, and connection on your site belongs to a category. The defaults are necessary, analytics, marketing, and preferences. You can rename them, add your own, or remove the ones you don't use.

A category can be:

  • Read-only (readOnly: true): always on, the visitor can't toggle it. necessary is read-only by default.
  • Enabled by default (enabled: true): pre-checked in opt-out mode. Ignored in opt-in mode, where everything starts unchecked.

Categories can contain services, named toggles within a category for individual vendors (for example, Google Analytics inside the analytics category). The visitor can accept or reject services independently if you enable per-service consent.

Categories are also the unit of script blocking. To gate a script by category, mark it with type="text/plain" and data-src so the browser doesn't fetch it before the runtime can intercept. See Categories, services, and purposes and the blocking guide for the full pattern.

Regional rules

A regional rule matches visitors by country or country subdivision and overrides the consent model, default categories, consent lifetime, button layout, privacy signal behavior, and banner text for that region.

CookieBeam ships framework presets for GDPR, CCPA/CPRA, US opt-out states, LGPD, PIPEDA, and UK GDPR. Each preset sets the consent model, the required buttons, and the recommended defaults. You can customize any preset or write your own rules from scratch.

A rule that names the visitor's subdivision always wins over a country-only rule. Priority (higher number wins, then list order) only breaks ties within each group. A separate fallback applies when no rule matches. See Regions and regimes.

The scanner

CookieBeam's scanner visits your site in a headless browser and records every cookie, script, and network connection the page makes. It classifies each one by vendor and category using URL patterns, inline content matching, and a database of known trackers.

The scanner runs on demand or on a schedule. Its results populate the blocking inventory in the dashboard, where you can review, reclassify, or approve each item. After a scan, you can auto-generate blocking rules for everything the scanner found.

The scanner also powers drift detection: the CDN script monitors the live site for new scripts and connections that weren't in the last scan and reports them back for triage.

The dashboard

The dashboard is the web application at cookiebeam.com where you:

  • Create and configure banners (categories, appearance, translations, regional rules, integrations).
  • Run and review scans.
  • Publish banners to the CDN. Publishing generates the script bundle visitors load.
  • View consent analytics: opt-in rates, category breakdowns, regional trends.
  • Manage team members and their permissions (viewer, editor, publisher, admin, owner).
  • Configure environments (dev, staging, production) so you can test changes before they go live.

Every banner has a public ID. That ID appears in the loader URL and identifies which configuration the CDN serves.

Integrations

CookieBeam maps your categories to Google's seven consent signals (ad_storage, ad_user_data, ad_personalization, analytics_storage, functionality_storage, personalization_storage, security_storage). It fires gtag('consent', 'default', ...) at page load and gtag('consent', 'update', ...) when the visitor chooses. Google tags and GTM templates read these signals natively. See Consent Mode v2.

Google Tag Manager

CookieBeam pushes consent events to the GTM dataLayer so your triggers and tags can react to consent changes without custom code.

IAB TCF 2.3

CookieBeam is a registered CMP (ID 526) for the IAB Transparency and Consent Framework. When TCF is enabled, the banner loads the Global Vendor List, builds a TC string encoding purpose and vendor consent, and exposes the __tcfapi stub that ad-tech vendors call. See IAB TCF.

IAB GPP

The Global Privacy Platform encodes multi-jurisdiction signals in a single string. CookieBeam supports the US national section, US state sections (California, Virginia, Colorado, Connecticut, Utah, and others), and the TCF EU v2 section. See IAB GPP.

Privacy signals

The runtime reads navigator.globalPrivacyControl (Global Privacy Control) and, optionally, navigator.doNotTrack. When a signal is detected, CookieBeam can hard-opt-out categories, pre-deselect them, or show a status notice confirming the signal was processed. See Privacy signals.

Hosting and delivery

Published banners are served from cdn.cookiebeam.com. The CDN path is:

cdn.cookiebeam.com/banner/{BANNER_ID}/default/loader.js

If you use environments, each environment has its own path:

cdn.cookiebeam.com/banner/{BANNER_ID}/env/{slug}/loader.js

The default/ path always points to the production environment. The loader is a small script that fetches the full banner bundle, which includes your configuration, translations, and the core runtime.

Translations that aren't inlined in the bundle are fetched on demand from the CDN when the visitor's detected language needs them.

The visitor's choice is stored in a first-party cookie on your domain (default name: cb_cookie). The cookie holds a JSON object with the accepted categories, timestamps, the banner revision, a consent identifier and metadata about how the choice was collected.

Your server, your client-side code, and CookieBeam's own runtime all read the same cookie. The Browser API provides methods like acceptedCategory('analytics') and events like cookiebeam:consentUpdate for client-side checks. For server-side reading, see Read consent on your server.

The consent record's schema is stable. See Consent record for the field-by-field reference.

What's next

If you're setting up CookieBeam for the first time, start with Getting started. If you're here to understand a specific concept before configuring it, the rest of this section covers each one: