Direct naar de documentatie

Configuration reference

Reference for CookieBeam's RuntimeConfig, covering the main configuration fields, their types, allowed values, and default behavior.

Laatst bijgewerkt:

This page documents the main fields on the RuntimeConfig object that the CookieBeam runtime reads. Some internal or rarely used fields (such as purposeConsent and guiOptions.consentModal.tcfHideDescription) are omitted. Dashboard-managed banners build this configuration automatically when you publish. Self-hosted installs pass it to CookieBeam.run(config).

Fields are grouped by section. Each table lists the field name, its TypeScript type, the default value (if any), and what it controls. Cross-links point to the guide pages that explain each feature in depth.

Top-level fields

FieldTypeDefaultDescription
mode'opt-in' | 'opt-out''opt-in'Consent model. Opt-in: nothing non-necessary runs until the visitor accepts. Opt-out: categories pre-activated until the visitor opts out. See Consent model.
revisionnumber-Configuration revision. A mismatch with the stored consent triggers re-consent. See Categories.
autoShowbooleantrueWhether the banner auto-shows on page load when the visitor has no valid consent.
hideFromBotsbooleantrueSkip showing the banner to detected bots and crawlers.
disablePageInteractionOnShowbooleanfalseBlock page interaction (dim the background) while the consent modal is visible.
manageScriptTagsbooleantrueEnable automatic script blocking. See Blocking.
autoClearCookiesbooleantrueAuto-remove cookies and storage when a category is revoked. See Categories.
consentIdMode'off' | 'accepted' | 'any-choice''off'Controls whether the runtime creates a per-consent identifier. off: the consentId field holds 'anonymous'. accepted: creates an identifier when the visitor accepts at least one optional category. any-choice: creates an identifier on every explicit choice, including refusals. See Consent identifier.
writeOptInDefaultAtLoadbooleantrueWrite a default consent record on page load in opt-in mode. When false, opt-in visitors stay cookieless until they make a choice.

Controls the consent cookie. See Cross-domain consent for subdomain sharing.

FieldTypeDefaultDescription
namestring'cb_cookie'Cookie name.
expiresAfterDaysnumber182Days until the cookie expires (~6 months).
domainstring''Cookie domain. Empty uses the current host (host-only cookie). Set to example.com for subdomain sharing.
pathstring'/'Cookie path.
securebooleantrueOnly send over HTTPS.
sameSite'Strict' | 'Lax' | 'None''Lax'SameSite attribute.
useLocalStoragebooleanfalseStore consent in localStorage instead of a cookie.

storage

FieldTypeDefaultDescription
enabledbooleanfalseEnable localStorage fallback for contexts where cookies aren't available (iframes, SameSite restrictions).

categories

A map of category ID to CategoryConfig. See Categories and purposes.

FieldTypeDefaultDescription
enabledboolean-Default state in opt-out mode. Ignored in opt-in mode.
readOnlyboolean-If true, the visitor can't toggle this category off. Used for strictly necessary storage.
servicesRecord<string, ServiceConfig>-Optional per-vendor toggles within this category.
autoClearAutoClearConfig-Storage to remove when this category is revoked.

ServiceConfig

FieldTypeDescription
labelstringDisplay name in the preferences panel.
onAccept() => voidCallback when this service is accepted.
onReject() => voidCallback when this service is rejected.
cookiesAutoClearCookieEntry[]Cookies to clear when this service is revoked.

AutoClearConfig

FieldTypeDescription
cookiesAutoClearCookieEntry[]Cookie entries to remove (exact name or regex).
localStoragestring[]localStorage keys to remove.
sessionStoragestring[]sessionStorage keys to remove.
reloadPagebooleanReload the page after clearing. Default: false.

AutoClearCookieEntry

Either { name: string, domain?: string, path?: string } for exact matching, or { name: RegExp } for pattern matching.

guiOptions

Controls the banner's layout and behavior. See Appearance.

consentModal

FieldTypeValuesDescription
layoutConsentModalLayoutbox, box wide, box inline, cloud, cloud inline, bar, bar inlineBanner layout variant.
positionModalPositiontop left, top center, top right, middle left, middle center, middle right, bottom left, bottom center, bottom rightWhere the banner appears.
equalWeightButtonsboolean-Give primary and secondary buttons equal visual weight.
flipButtonsboolean-Reverse button order (reject first).
showAcceptNecessaryboolean-Show the "Accept necessary" button. Default: true.
preferencesTriggerstringbutton, footerLinkWhere the preferences link appears.
animationAnimationConfig-Entrance animation. See below.

preferencesModal

FieldTypeValuesDescription
layoutstringbox, side, side wide, barPreferences modal layout.
positionstringleft, right, center, top, bottom, and all 9 corner/edge positionsWhere the preferences modal appears.
equalWeightButtonsboolean-Equal visual weight for buttons.
flipButtonsboolean-Reverse button order.
showAcceptNecessaryboolean-Show the reject button. Default: true.
controlStylestringtoggle, checkboxHow consent choices render. Default: toggle.

Other guiOptions fields

FieldTypeDescription
showCloseButtonbooleanShow X button and enable Escape to dismiss. Default: false.
floatingSettingsButtonFloatingSettingsConfigFloating re-entry button after consent. See Appearance.
darkMode'auto' | 'light' | 'dark'Color scheme mode. Default: 'light'.
logoLogoConfigSite logo in the banner.
languageSwitcherLanguageSwitcherConfigVisitor-facing language menu. See Languages.

AnimationConfig

FieldTypeDescription
entrancestringfade, slide-up, slide-down, scale, none.
durationnumberDuration in milliseconds.
respectPrefersReducedMotionbooleanHonor prefers-reduced-motion. Default: true.

language

Controls language detection and translation loading. See Languages.

FieldTypeDefaultDescription
defaultstring'en'Fallback language code.
autoDetectstring'browser'Detection mode: browser, document, geo, none.
translationsRecord<string, TranslationData>-Inline translations keyed by language code.
rtlLanguagesstring[]-Language codes that render right-to-left.
dynamicLanguagesstring[]-Language codes fetchable on demand from CDN.
cdnTranslationUrlstring-URL template with {lang} placeholder for CDN fetches.
translationResolverTranslationResolver{ type: 'inline' }Custom resolver (URL template or function).

consentMode

Google Consent Mode v2 integration. See Consent Mode v2.

FieldTypeDefaultDescription
enabledbooleanfalseEnable Consent Mode integration.
setDefaultsOnLoadbooleantrueFire gtag('consent', 'default', ...) on page load.
redactAdsDatabooleanfalseEnable ad data redaction when ad_storage is denied.
passiveAnalyticsbooleanfalseWhen enabled, pushes a dataLayer marker (cookiebeam_cmp_mode: 'passive') when analytics_storage is denied. Does not grant analytics_storage.
waitForUpdatenumber2000Milliseconds to tell Google tags to wait for consent before firing.
urlPassthroughbooleantruePass ad click identifiers in URLs across domains.
deferMachineDefaultsboolean-Defer machine-written default consent until explicit consent.

tcf

IAB TCF 2.3 configuration. See IAB TCF.

FieldTypeDefaultDescription
enabledbooleanfalseEnable TCF framework.
cmpIdnumber0CMP ID. The published banner script sets this to CookieBeam's registered ID (526); the runtime default is 0.
cmpVersionnumber-CMP implementation version.
gvlUrlstring-Custom URL for the Global Vendor List JSON.
vendorListVersionnumber-Pin a specific GVL version.
visitorOutsideScopebooleanfalseSkip TCF for this visitor (set by the banner from geo data).

gpp

IAB GPP configuration. See IAB GPP.

FieldTypeDefaultDescription
enabledbooleanfalseEnable GPP framework.
cmpIdnumber-Registered GPP CMP ID.
sectionsGppSectionName[]-Which GPP sections to include in the string.

GppSectionName values

tcfeuv2, uspv1, usnat, usca, usva, usco, usct, usut, usfl, usmt, usor, ustx, usde, usia, usne, usnh, usnj, ustn, usmn, tcfcav1

gpc

GPC-specific configuration (self-hosted API). See Privacy signals.

When a gpc object is present in the config, the runtime honors the GPC signal by default. Set enabled: false to suppress it.

FieldTypeDefaultDescription
enabledbooleantrue (when the gpc object is present)Whether to honor the GPC signal. The runtime honors GPC whenever this object exists, unless enabled is explicitly false.
autoOptOutCategoriesstring[][]Category IDs to auto-reject when GPC is detected.

privacySignals

Dashboard-emitted privacy signal settings. An explicit gpc key takes precedence over the GPC fields here. See Privacy signals.

FieldTypeDefaultDescription
respectGpcboolean-Honor GPC signal.
respectDntboolean-Honor DNT signal.
modestring-'hard_optout' or 'preselect_deny'.
categoriesToBlockstring[]-Categories to strip when a signal is present. Empty means all non-readOnly.
showToastboolean-Show a toast when the signal is honored.
toastDurationMsnumber5000Toast display duration in milliseconds.

scriptGating

Custom attribute names for manual script gating. See Blocking.

FieldTypeDefaultDescription
dataAttributeNamestring'data-category'Attribute that names the consent category.
placeholderTypeValuestring'text/plain'Script type value that prevents execution.
srcAttributeNamestring'data-src'Attribute that holds the real script URL.

Lifecycle callbacks

Callbacks on the RuntimeConfig fire at specific consent lifecycle events. See Events reference.

CallbackFires when
onFirstConsentThe visitor makes their first explicit choice (not on defaults).
onConsentAny consent write: first consent, defaults, and subsequent changes. Does not fire on restored consent (return visits with a valid record).
onChangeThe visitor changes their consent (accepts or revokes a category).
onModalShowThe consent or preferences modal becomes visible.
onModalHideA modal is dismissed.
onModalReadyThe modal has been created in the DOM and is ready to show.

regionalSettings

Regional rule configuration. See Regional rules.

FieldTypeDescription
enabledbooleanEnable regional rules.
fallbackobjectBehavior when no rule matches. See Regional rules.
rulesRegionalRule[]The ordered list of regional rules. See Regional rules.

gtm

Google Tag Manager loader integration.

FieldTypeDefaultDescription
enabledbooleanfalseWhether the banner was loaded through a GTM template.
containerIdsstring[]-GTM container IDs associated with this banner.

experiment

A/B test configuration. Set automatically when a banner has an active experiment. Requires testId, variantId, and variantKey together; if any is missing the experiment config is dropped.

FieldTypeDescription
testIdstringThe experiment's identifier. Required.
variantIdstringThe assigned variant's identifier. Required.
variantKeystringThe experiment variant key assigned to this visitor. Required.
consentModelOverrideobjectOptional override that changes the consent model for this variant.
regionalOverrideobjectOptional regional behavior override for this variant.

See A/B testing.

environment

Loader-passed environment data. These fields are set by the CDN loader, not by the site owner.

FieldTypeDescription
apiBaseUrlstringBase URL for the CookieBeam API.
cdnBaseUrlstringBase URL for the CookieBeam CDN.
cfCountrystringISO 3166-1 alpha-2 country code from the CDN edge.
cfRegionstringISO 3166-2 subdivision code from the CDN edge.
bannerIdstringInternal banner identifier.
publicBannerIdstringPublic-facing banner identifier.
isGtmLoadbooleanWhether the runtime was loaded via a GTM template.
variantKeystringA/B test variant from the loader (when an experiment is active).
precomputedRegionalBehaviorobjectRegional rule result pre-computed by the CDN loader to avoid re-matching.