Skip to main content

CookieFirst

Integrates CookieFirst consent management with walkerOS by listening for CookieFirst events and translating consent categories to walkerOS consent groups.

Installation

npm install @walkeros/web-source-cmp-cookiefirst
import { startFlow } from '@walkeros/collector';
import { sourceCookieFirst } from '@walkeros/web-source-cmp-cookiefirst';

await startFlow({
sources: {
consent: {
code: sourceCookieFirst,
},
},
});

Configuration

This source uses the standard source config wrapper (consent, data, env, id, ...). For the shared fields see source configuration. Package-specific fields live under config.settings and are listed below.

Settings

PropertyTypeDescriptionMore
categoryMapRecord<string, string>Map the CMP's consent categories (keys) to walkerOS consent groups (values).
explicitOnlybooleanOnly process consent after the user made an explicit choice. Ignores default/implicit states. Default: true.
globalNamestringCustom name for the CookieFirst global on window. Default: 'CookieFirst'.

Mapping

This package does not define custom rule-level settings. For the standard rule fields (consent, condition, data, batch, name, policy) see mapping.

Examples

category map override

Event
Mapping
Out

cf init detection

Event
Out

full consent

Event
Out

partial consent

Event
Out

How it works

  1. Initialization: Checks if CookieFirst is already loaded and processes existing consent state from window.CookieFirst.consent.

  2. cf_init event: Listens for the cf_init event fired when CookieFirst banner initializes.

  3. cf_consent event: Listens for the cf_consent event fired when user changes consent preferences.

  4. Consent mapping: Translates CookieFirst categories to walkerOS consent groups and calls elb('walker consent', state).

Default category mapping

{
necessary: 'functional',
functional: 'functional',
performance: 'analytics',
advertising: 'marketing',
}

When multiple CookieFirst categories map to the same walkerOS group (e.g., both necessary and functional to functional), the source uses OR logic: if ANY source category is true, the target group is true.

Custom mapping example

await startFlow({
sources: {
consent: {
code: sourceCookieFirst,
config: {
settings: {
categoryMap: {
performance: 'statistics', // Use 'statistics' instead of 'analytics'
},
explicitOnly: true,
},
},
},
},
});

Reference

💡 Need implementation support?
elbwalker offers hands-on support: setup review, measurement planning, destination mapping, and live troubleshooting. Book a 2-hour session (€399)