---
title: "Consent modes"
description: "How CookieBeam's three consent modes control what runs before and after a visitor makes a choice, and how regional rules switch between them."
url: "https://cookiebeam.com/docs/concepts/consent-model"
lang: "en"
last_updated: "2026-11-25"
---

# Consent modes

How CookieBeam's three consent modes control what runs before and after a visitor makes a choice, and how regional rules switch between them.

Every CookieBeam banner operates in one of three modes: **opt-in**, **opt-out**, or **notice**. The mode decides what happens the moment a page loads, what the visitor sees, and how the consent record is written.

## How the mode is set

The base mode is set in your banner configuration: opt-in or opt-out. That's the default for every visitor.

[Regional rules](https://cookiebeam.com/docs/configure/regional-rules) can override it per location. A rule for the EU can set opt-in while a rule for California sets opt-out, and a fallback rule can set notice for everywhere else. The resolved mode for a given visitor comes from the best matching regional rule (subdivision matches beat country-only, then by priority), the fallback's mode if no rule matches, or the base mode if regional rules are disabled.

The resolved mode is one of three values: `optIn`, `optOut`, or `notice`. Notice is only available through a regional rule or fallback; it can't be set as the base mode.

## Opt-in

Opt-in is the strictest mode. Non-necessary categories start disabled. Nothing in those categories runs until the visitor makes a choice, with two exceptions: when a regional rule sets `scopedCategories`, any category not in that list is treated as always granted (unscoped) even in opt-in mode; and when a rule lists `preGrantedCategories`, analytics-type categories in that list (analytics and statistics) are granted before the visitor chooses, provided the rule's Consent Mode defaults don't deny `analytics_storage`.

**At page load:**

1. If `writeOptInDefaultAtLoad` is `true` (the bare-runtime default, but published banners set it to `false`), the runtime writes a pending consent record (see [The pending record](#the-pending-record) below). No non-necessary scripts or cookies are allowed.
2. The banner appears. The visitor can accept all, reject all, or choose individual categories.

**On accept:**

The runtime enables the accepted categories, rewrites the consent record with `isPending: false`, and unblocks the scripts and cookies in those categories. The record's `acceptType` is `all` if they accepted everything, `custom` if they picked specific categories, or `necessary` if they rejected everything optional.

**On reject (accept necessary only):**

The consent record is written with only the necessary category. `acceptType` is `necessary`. Non-necessary scripts stay blocked.

**What gets stored:**

The consent record's `categories` array contains exactly what the visitor accepted. `collectedVia` is `banner` (from the initial banner) or `preferences` (from the preferences modal). `isDefaultState` is absent or `false`.

Opt-in is the mode privacy laws like the GDPR require for most processing in the EU.

## Opt-out

Opt-out starts permissive. Categories flagged `enabled: true` (plus all `readOnly` categories) are granted at load, and the visitor must actively reject them to remove access. New themes start with all three standard categories enabled, so in opt-out mode they all run at load unless you or a regional preset changes the category flags.

**At page load:**

1. The runtime writes a default consent record with all `readOnly` and `enabled: true` categories. This record has `isDefaultState: true` and `collectedVia` set to `default_optout`.
2. Scripts and cookies in those categories run immediately.
3. The banner appears. The visitor can keep all, reject some, or reject all optional categories.

**On reject:**

The runtime removes the rejected categories from the record, clears cookies in those categories (if auto-clear is on), and blocks their scripts. `isDefaultState` becomes `false` and `collectedVia` changes to `banner` or `preferences`.

**On accept (confirm all):**

The record is rewritten as an explicit choice: `isDefaultState` becomes `false`, `acceptType` is `all`, `collectedVia` is `banner` or `preferences`. Nothing changes about what runs.

**What gets stored:**

Before the visitor acts, the record has `isDefaultState: true`, `collectedVia: 'default_optout'`, and carries all categories. After they act, `isDefaultState` is `false` and `collectedVia` reflects the surface they used.

Opt-out fits US state privacy laws (CCPA, CPA, CTDPA and others) where processing is allowed until the consumer objects.

## Notice

Notice is informational. It works like opt-out, but the banner tells the visitor what the site does rather than offering category toggles.

**At page load:**

1. The runtime writes a default record with all categories enabled. `isDefaultState: true`, `collectedVia: 'default_notice'`.
2. Everything runs immediately.
3. The banner appears as a notice. The visitor can acknowledge it but can't change categories from it.

**On acknowledge:**

The record is rewritten with `isDefaultState: false` and `collectedVia: 'banner'`. Categories don't change.

**Opening preferences:**

If the preferences modal is reachable (through a settings link or the floating button), the visitor can still change categories from there. That follows the same logic as opt-out: rejected categories are removed.

Notice mode is only available through a [regional rule](https://cookiebeam.com/docs/configure/regional-rules) or the regional fallback. You can't set it as the base mode because the base configuration only offers opt-in and opt-out. A common pattern is to set the base to opt-in and configure the regional fallback with notice mode for locations where no stricter law applies.

## The pending record

In opt-in mode, the runtime can write a consent record at page load even though the visitor hasn't chosen yet. That record has `isPending: true` and grants nothing.

The `writeOptInDefaultAtLoad` option controls this. The bare-runtime default is `true`, but published banners set it to `false`. When `false`, no cookie is written until the visitor makes a choice.

### How to interpret `isPending` and `isDefaultState`

These two flags interact:

| `isPending` | `isDefaultState` | `collectedVia` | Meaning |
| --- | --- | --- | --- |
| `true` | `true` | `default_optin` | Opt-in default. No consent granted. |
| absent/`false` | `true` | `default_optout` | Opt-out default. Categories are in effect but the visitor hasn't actively chosen. |
| absent/`false` | `true` | `default_notice` | Notice default. Same as above. |
| absent/`false` | `true` | `hidden_autogrant` | A regional auto-grant for a hidden region. Categories are in effect. |
| absent/`false` | absent/`false` | `banner` / `preferences` / `api` | Explicit visitor choice. Categories are in effect. |

When Google Consent Mode is on, opt-out and notice defaults can also carry `isPending: true` alongside `isDefaultState: true`. This is controlled by the `deferMachineDefaults` setting and exists so that the GTM Consent Mode template doesn't restore the default as a grant before the runtime announces it. In this case, the record still grants its categories (because `isDefaultState` is `true` and `collectedVia` is one of `default_optout`, `default_notice`, or `hidden_autogrant`). See [The consent record](https://cookiebeam.com/docs/concepts/consent-record) for the full rule.

The short version: `isPending: true` means "no consent" **unless** the record is also a granting default (`isDefaultState: true` with one of the three machine-written `collectedVia` values).

## When the mode changes per visitor

Regional rules are the primary way the mode varies. A single banner configuration can produce opt-in, opt-out, and notice experiences depending on the visitor's location. The runtime resolves the mode once, at load, from the best matching rule (subdivision matches always beat country-only). See [Regions and regimes](https://cookiebeam.com/docs/concepts/regions-and-regimes) for how rules are matched.

[A/B experiments](https://cookiebeam.com/docs/configure/ab-testing) can also override the consent mode for a share of time. An experiment arm can set its own mode, which takes precedence over the regional resolution when the arm applies. The arm is assigned from the current hourly time slot, so every visitor in the same hour sees the same arm without storing the assignment in a cookie.

## Revision and re-consent

The consent mode doesn't change what happens when you bump the revision. In any mode, when **Ask visitors again** is turned on and the banner's revision goes up, every stored record with an older revision is treated as no consent. The banner shows again and the visitor makes a fresh choice under the current mode.

See [The consent record](https://cookiebeam.com/docs/concepts/consent-record) for details on the revision field and re-consent.

## Summary

| | Opt-in | Opt-out | Notice |
| --- | --- | --- | --- |
| Non-necessary categories at load | Disabled | Enabled | Enabled |
| Banner asks visitor to | Accept | Reject (or confirm) | Acknowledge |
| Scripts run before choice | No (necessary only) | Yes (all categories) | Yes (all categories) |
| `isDefaultState` on the default record | `true` | `true` | `true` |
| `collectedVia` on the default record | `default_optin` | `default_optout` | `default_notice` |
| Available as base mode | Yes | Yes | No (regional/fallback only) |
| Typical legal context | GDPR, ePrivacy | CCPA, US state opt-out | No specific consent law |
