CMP sources
walkerOS provides source packages for these Consent Management Platforms. Each
source listens for CMP events and calls elb('walker consent', state) itself,
so you need no event listener code of your own.
| CMP | Package |
|---|---|
| Cookiebot | @walkeros/web-source-cmp-cookiebot |
| CookieFirst | @walkeros/web-source-cmp-cookiefirst |
| CookiePro / OneTrust | @walkeros/web-source-cmp-cookiepro |
| Usercentrics | @walkeros/web-source-cmp-usercentrics |
Conditional activation with require
Some sources and destinations shouldn't act on lifecycle events right away.
They may depend on consent status being resolved first, or need information
provided by other sources (like session IDs). The require option solves this
by gating on() delivery (for sources) or initialization (for destinations)
until specific collector events have fired.
Add require to any source or destination config to gate it on the listed
events:
{
"sources": {
"consent": {
"package": "@walkeros/web-source-cmp-cookiefirst"
},
"dataLayer": {
"package": "@walkeros/web-source-datalayer",
"config": { "require": ["consent"] }
}
}
}In this example the CMP source initializes immediately and calls
elb('walker consent', state) once a consent state is known. Until then, the
dataLayer source holds back its run delivery, so the dataLayer entries that
existed before its init() ran are replayed only after a consent state is
recorded. require does not stop a source from capturing: entries pushed to
the dataLayer after its init() ran enter the flow at once. To drop a source's
events without consent, set the source's config.consent (see the
consent guide).
How require works
- Sources are registered immediately and their
Instance.init()runs eagerly after registration.requiredoes not block init; it gateson()delivery. Lifecycle events targeted at a source with unmetrequireare buffered inInstance.queueOn. - Destinations with
requireare held as pending during initialization until their listed events fire. - A
requireentry is satisfied by the collector's current recorded state, not only by a future event. So order does not matter: a step activates whether the required state (such as a CMP applying consent) was recorded before or after the step registered. The collector reconciles every pending step against current state at each state change, at the run barrier, and once after all sources have registered. - Sources whose
requirejust emptied have their queued lifecycle events replayed viasource.on(type, data). Destinations whoserequirejust emptied are registered and receive the current run's events from the collector's replay buffer (bounded by the collector'squeueMax), unless they setqueue: false. The destination'son()handler receives the current state, including the consent state that activated it, before those events are delivered.
Key points
- CMP sources need no
require: a CMP source reads and reports consent ininit(), whichrequiredoes not delay, and it has noon()to hold back - Accepted values: any collector event type, such as
"consent","session","user","run","config","globals", etc. - AND logic:
require: ["consent", "session"]waits for both events - Chained activation: a source still runs
init()while it waits onrequire, so a command it sends can satisfy another step'srequire. The session source withoutsettings.consent, for example, recordssessionwhen the collector runs, which activates a step waiting for["session"]
How CMP sources work
- Detecting if the CMP is already loaded and reading existing consent
- Listening for CMP-specific events on consent changes
- Mapping CMP categories to walkerOS consent groups via
categoryMap - Calling
elb('walker consent', state)with the mapped state
CMP sources perform their initial consent read during init(), not in the
source factory. The factory stays side-effect free; the consent emit happens
once the collector runs the source's init(). Combined with the current-state
require matching above, a require: ["consent"] step activates once any
source has recorded a consent state, granted or denied, before or after the
step registered.
When several CMP categories map to the same walkerOS group, every CMP source grants the group only if all of them are granted: any deny denies. The default mappings map each category to its own group.
By default every CMP source reports only a choice the visitor made: the
Cookiebot, CookiePro and Usercentrics sources support explicitOnly (default:
true) to skip implicit or default consent and report only active user choices,
and the CookieFirst source reports nothing until the visitor has made a choice.
A visitor who never makes a choice, for example one Cookiebot never asks because
they are outside the regions where your site asks for consent, sends no consent.
Destinations gated with config.consent then keep that visitor's events queued
and never send them (each push answers queued with the reason consent), a
destination with require: ["consent"] never starts, and sources gated with
config.consent drop the events. To follow the consent the CMP sets on its own, set
explicitOnly: false on the Cookiebot, CookiePro or Usercentrics source.
Strictly necessary cookies need no consent, so no CMP source maps them to a
consent group: the Cookiebot, CookieFirst and CookiePro sources report them as
necessary, and the Usercentrics source reports your essential category under
its own name.
For more details on how consent works in walkerOS, see the consent management guide.