@walkeros/web-source-cmp-usercentrics
v4.6.0
Published
Usercentrics consent management source for walkerOS
Maintainers
Readme
@walkeros/web-source-cmp-usercentrics
Integrates Usercentrics consent management with walkerOS using the official Usercentrics events and consent getters, mapping category or service consent state to walkerOS consent groups.
Documentation • NPM Package • Source Code
Installation
npm install @walkeros/web-source-cmp-usercentricsQuick start
import { startFlow } from '@walkeros/collector';
import { sourceUsercentrics } from '@walkeros/web-source-cmp-usercentrics';
await startFlow({
sources: {
consent: {
code: sourceUsercentrics,
},
},
});How it works
The source uses Usercentrics' official integration surface, no custom data-layer event is required:
- Already initialized: if the CMP has loaded before the source, consent is read
statically through the official getters (V2
UC_UI.getServicesBaseInfo(), V3__ucCmp.getConsentDetails()). - CMP loads after the source: the source listens for
UC_UI_INITIALIZEDand reads the current consent state once the CMP signals it is ready. - User decisions: the source listens for
UC_UI_CMP_EVENT(consent actionsACCEPT_ALL,DENY_ALL, andSAVE) and republishes the updated state.
Consent is then mapped via categoryMap and published with
elb('walker consent', state).
Timing considerations
A returning visitor's prior choice is applied on page load, either from the
static getter read (CMP already initialized) or on UC_UI_INITIALIZED (CMP
loads later). First-visit defaults are suppressed under the default
explicitOnly: true: only a state the user has actively decided is published
(V3 consent.type === EXPLICIT; V2 an EXPLICIT entry in the service consent
history). Set explicitOnly: false to publish any consent snapshot, including
implicit first-visit defaults.
Settings
explicitOnly (default true) is the cross-version gate for "the user has
actively decided," applied identically for V2 and V3. There is no configurable
data-layer event setting: the eventName setting has been removed, and the
source listens to the always-emitted official events.
Documentation
Full configuration, mapping, and examples live in the docs: https://www.walkeros.io/docs/sources/web/cmps/usercentrics
Contribute
Feel free to contribute by submitting an issue, starting a discussion, or getting in contact.
License
MIT
