CookieFirst
Installation
npm install @walkeros/web-source-cmp-cookiefirst
Usage
import { startFlow } from '@walkeros/collector';
import { sourceCookieFirst } from '@walkeros/web-source-cmp-cookiefirst';
await startFlow({
sources: {
consent: {
code: sourceCookieFirst,
},
},
});
Settings
| Setting | Type | Default | Description |
|---|---|---|---|
categoryMap | Record<string, string> | See below | Maps CookieFirst categories to walkerOS consent groups |
explicitOnly | boolean | true | Only process explicit consent (user made a choice) |
globalName | string | 'CookieFirst' | Custom name for window.CookieFirst object |
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,
},
},
},
},
});
How it works
-
Initialization: Checks if CookieFirst is already loaded and processes existing consent state from
window.CookieFirst.consent. -
cf_init event: Listens for the
cf_initevent fired when CookieFirst banner initializes. -
cf_consent event: Listens for the
cf_consentevent fired when user changes consent preferences. -
Consent mapping: Translates CookieFirst categories to walkerOS consent groups and calls
elb('walker consent', state).
Reference
💡 Need Professional Support?
Need professional support with your walkerOS implementation? Check out our services.