CookiePro / OneTrust
Integrates CookiePro / OneTrust consent management with walkerOS by mapping CookiePro category IDs (C0001, C0002, ...) to walkerOS consent groups.
Installation
npm install @walkeros/web-source-cmp-cookiepro
import { startFlow } from '@walkeros/collector';
import { sourceCookiePro } from '@walkeros/web-source-cmp-cookiepro';
await startFlow({
sources: {
consent: {
code: sourceCookiePro,
},
},
});
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
| Property | Type | Description | More |
|---|---|---|---|
categoryMap | Record<string, string> | Map the CMP's consent categories (keys) to walkerOS consent groups (values). | |
explicitOnly | boolean | Only process consent after the user closed the OneTrust banner (IsAlertBoxClosed). Default: true. | |
globalName | string | Custom name for the OneTrust global on window. Default: 'OneTrust'. |
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
full consent
minimal consent
sdk loaded detection
How it works
-
Already loaded: Checks if
window.OneTrustandwindow.OptanonActiveGroupsalready exist. If so, processes consent immediately. -
OptanonWrapper: If the SDK isn't loaded yet, wraps the global
OptanonWrappercallback (preserving any existing wrapper). The wrapper self-unwraps after the first call. -
OneTrustGroupsUpdated event: Listens for the
OneTrustGroupsUpdatedwindow event, which fires on every consent change. -
Parsing: Splits the
OptanonActiveGroupscomma-separated string, maps category IDs throughcategoryMap, and callselb('walker consent', state). Sets explicitfalsefor all mapped groups not in the active list.
CookiePro categories
CookiePro registers cookies and assigns them to categories. Those categories are mapped to walkerOS consent groups:

Default category mapping
{
C0001: 'functional', // Strictly Necessary
C0002: 'analytics', // Performance
C0003: 'functional', // Functional
C0004: 'marketing', // Targeting
C0005: 'marketing', // Social Media
}
Category ID comparison is case-insensitive. Unmapped category IDs are ignored
since CookiePro's opaque IDs are meaningless without a mapping. All mapped
walkerOS groups receive explicit true/false values. Absent groups are set
to false so destinations know which consent is denied.
Custom entries are merged with the default mapping. Specify only the categories you want to override. All other defaults remain active.
Custom mapping example
await startFlow({
sources: {
consent: {
code: sourceCookiePro,
config: {
settings: {
categoryMap: {
C0002: 'statistics', // Use 'statistics' instead of 'analytics'
},
explicitOnly: true,
},
},
},
},
});
Timing considerations
The source handles all timing scenarios:
- SDK loads before source: The "already loaded" check reads existing consent
from
OptanonActiveGroupsimmediately. - Source loads before SDK: The
OptanonWrapperwrapping intercepts the SDK's init callback. explicitOnly(default): UsesOneTrust.IsAlertBoxClosed()to determine if the user has actively interacted with the consent banner.