@adobe/helix-rum-enhancer 2.51.0 → 2.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,43 @@
1
+ # [2.52.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.51.1...v2.52.0) (2026-11-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **consent:** classify stored levels without interaction evidence ([cfe1afc](https://github.com/adobe/helix-rum-enhancer/commit/cfe1afc4550a960902aed2824e7164731d27d692))
7
+
8
+
9
+ ### Features
10
+
11
+ * **consent:** report stored consent choices ([f380ab9](https://github.com/adobe/helix-rum-enhancer/commit/f380ab951b79275ecc3c4d32246a3475d6984783)), closes [#407](https://github.com/adobe/helix-rum-enhancer/issues/407)
12
+
13
+ ## Unreleased
14
+
15
+ ### Consent reporting compatibility
16
+
17
+ The `consent` checkpoint now reports `granted`, `rejected`, or `customized` when
18
+ supported stored preferences are readable. These values describe the stored
19
+ consent level, including CMP defaults, **not an explicit visitor decision**.
20
+ For example, OneTrust can report `rejected` for an opt-in default with all
21
+ optional categories disabled, or `granted` for an opt-out default with all
22
+ optional categories enabled, before the visitor interacts and even while the
23
+ banner is visible. Usercentrics stored Google Consent Mode defaults can have the
24
+ same effect.
25
+
26
+ `show`, `hidden`, and `suppressed` remain fallback values only when the stored
27
+ level cannot be classified. Cookie-only provider detection can also report a
28
+ level before the CMP renders. Consequently, historical `show`/`hidden` ratios
29
+ and banner-visibility counts are not directly comparable across this release.
30
+ Update dashboards to separate stored consent levels from fallback banner states;
31
+ do not interpret `granted`/`rejected` counts as accept/reject button-click rates
32
+ or map them back to banner visibility.
33
+
34
+ ## [2.51.1](https://github.com/adobe/helix-rum-enhancer/compare/v2.51.0...v2.51.1) (2026-11-14)
35
+
36
+
37
+ ### Bug Fixes
38
+
39
+ * **deps:** update playwright to 1.65.0, which supports Ubuntu 26.04 ([4d91539](https://github.com/adobe/helix-rum-enhancer/commit/4d91539736c4cbc72fca44f5407edb68139ec868))
40
+
1
41
  # [2.51.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.50.1...v2.51.0) (2026-10-29)
2
42
 
3
43
 
package/README.md CHANGED
@@ -22,6 +22,62 @@ It will add following new checkpoints:
22
22
  - `viewmedia`: An image or video hosted by Helix Media Bus has been scrolled into the viewport
23
23
  - `reload`, `navigate`, `enter`: depending on how the current page was accessed
24
24
  - `formsubmit`: when a form is submitted
25
+ - `consent`: stored consent choice, or consent-banner state when the choice is unknown
26
+
27
+ ### Consent checkpoint
28
+
29
+ Consent plugins emit `sampleRUM('consent', { source, target })`, where `source` is
30
+ `onetrust`, `trustarc`, or `usercentrics`. A recognized stored consent level produces:
31
+
32
+ | `target` | Meaning |
33
+ | --- | --- |
34
+ | `granted` | All supported optional categories/signals are enabled. |
35
+ | `rejected` | All supported optional categories/signals are disabled. |
36
+ | `customized` | Some supported optional categories/signals are enabled and others disabled. |
37
+
38
+ Required cookies do not count as optional consent. If the stored level cannot be
39
+ classified, the existing `show`, `hidden`, or `suppressed` banner-state fallback
40
+ is retained. In particular, `hidden` does not mean `granted`. Classification uses
41
+ the level readable from storage, without requiring interaction evidence: the
42
+ enhancer runs on sampled pageviews and need not observe a consent interaction.
43
+
44
+ Supported formats:
45
+
46
+ - **OneTrust:** `OptanonConsent.groups`, including standard `Cdddd` and numeric IDs.
47
+ `C0001` or `1` identifies the necessary group; at least one optional group is required.
48
+ No dismissal cookie or interaction counter is required; these do not affect the
49
+ classification. Pending reconsent and malformed category data remain unclassified.
50
+ - **TrustArc:** standard three-bucket `notice_gdpr_prefs` (required `0`, optional `1`
51
+ and `2`), with the inclusive `notice_preferences` slider as a fallback only when
52
+ granular preferences are absent. Custom buckets/levels are not interpreted.
53
+ - **Usercentrics:** the four `uc_gcm` localStorage signals (`adStorage`,
54
+ `analyticsStorage`, `adPersonalization`, `adUserData`). If absent, the explicitly
55
+ supported `uc_consent_status_*` category-cookie integration is read: essential
56
+ must be `true` and functional, marketing, analytics, and personalisation must all
57
+ contain boolean strings. This integration is not present on every Usercentrics site.
58
+ The `uc_user_interaction` marker does not affect classification.
59
+
60
+ The plugins retain their **once-per-page snapshot** behavior; they do not listen
61
+ for subsequent consent changes on that page. No raw cookie values, category IDs,
62
+ controller IDs, or interaction timestamps are transmitted. These values describe
63
+ supported stored preferences, not individual button clicks or legal consent validity.
64
+ See the [customer-site investigation](docs/consent-cookie-research.md) for examples
65
+ and limitations.
66
+
67
+ #### Dashboard compatibility
68
+
69
+ Stored CMP defaults are classified too: a first-time visitor can produce
70
+ `rejected` with all optional categories disabled (an opt-in default), or `granted`
71
+ with all enabled (an opt-out default), before interacting and even while the
72
+ banner is visible. This applies to OneTrust groups and to readable Usercentrics
73
+ GCM defaults.
74
+
75
+ Because recognized levels replace banner-state targets, and cookie-only detection
76
+ can report a level before the CMP renders, `show`/`hidden` ratios and
77
+ banner-visibility counts are not directly comparable to older releases. Update
78
+ dashboards to separate consent-level targets from fallback banner states. Do not
79
+ use `granted`/`rejected` counts as accept/reject button-click rates or infer banner
80
+ visibility from them. See the [changelog](CHANGELOG.md#unreleased).
25
81
 
26
82
  ### The `source` parameter and the `sourceSelector`
27
83
 
@@ -0,0 +1,217 @@
1
+ # Consent-cookie investigation
2
+
3
+ Observed 2026-11-13. This investigation informed the [consent checkpoint implementation](../README.md#consent-checkpoint), which adds `granted`, `rejected`, and `customized` targets.
4
+
5
+ ## Scope and access
6
+
7
+ The initial three live OneTrust implementations were inspected through Playwright CLI attached to the existing SLICC Chrome browser over CDP and selected from customer implementation source. After Google Cloud reauthentication, access to `helix-225321.helix_rum` was verified and a one-day query (2026-11-12 UTC) selected further live examples: Canadian Tire, T-Mobile, Enel, Openbank, and Hamleys. Only hostname/provider/banner-state aggregates were retrieved; production traffic counts are not included in this repository document.
8
+
9
+ Initial observations did not change the user's saved consent choices. Reject, partial-consent, and accept tests on PartsASIST ran in a separate, disposable CDP browser context. The five BigQuery-selected sites were opened in another disposable context, including interaction tests on Enel, Openbank, and Hamleys. Both contexts and their cookies were subsequently destroyed. Only category bits and selected non-identifying status fields were inspected. No full cookies, consent IDs, timestamps, or authentication tokens are included here.
10
+
11
+ These are observations from one browser/network location, not exhaustive tests of all regional rules. Public source establishes implementation patterns, but is not proof that a particular commit is deployed on production.
12
+
13
+ ## Baseline enhancer behavior before this change
14
+
15
+ - `plugins/onetrust.js`: `OptanonAlertBoxClosed` means `hidden`; otherwise banner/preference-center visibility determines `show` or `suppressed`.
16
+ - `plugins/trustarc.js`: presence of both `notice_gdpr_prefs` and `notice_preferences` means `hidden`; values are not parsed.
17
+ - `plugins/usercentrics.js`: presence of localStorage `uc_gcm` means `hidden`; its contents are not parsed. This is **localStorage**, not a cookie.
18
+ - All three plugins send once per module lifetime. They do not observe later consent changes.
19
+ - `modules/index.js` detects OneTrust from the dismissal cookie or DOM, but not from `OptanonConsent` alone. A stored-state reader should also support cookie-only detection before the SDK renders.
20
+ - Only fields in `KNOWN_PROPERTIES` (`modules/defaults.js`) are serialized. Adding arbitrary `groups` or `consentLevel` properties to `sampleRUM` would silently lose them without a coordinated schema change.
21
+ - Downstream `rum-distiller/consent.js` separately classifies consent-button clicks into actions such as accept/reject/dismiss. A cookie snapshot is not another click or accept event.
22
+
23
+ **Banner visibility, enabled categories, and evidence of a recorded interaction are separate dimensions.** The existing `hidden` value proves neither acceptance nor rejection.
24
+
25
+ ## Live OneTrust observations
26
+
27
+ | Site | SDK version observed | `groups` field (decoded, not the full cookie) | `interactionCount` | Dismissal cookie | Banner |
28
+ | --- | --- | --- | --- | --- | --- |
29
+ | [PartsASIST](https://www.partsasist.com/) | `202503.2.0` | `C0001:1,C0002:0,C0004:0` | `0` | absent | shown |
30
+ | [CME Group education](https://www.cmegroup.com/education) | `202605.1.0` | `C0001:1,C0004:0,C0002:0,C0003:0,C0011:0` | `0` | absent | shown |
31
+ | [Intuit ERP](https://erp.intuit.com/) | `202601.2.0` | `1:1,4:1` | `0` | absent | absent |
32
+
33
+ ### PartsASIST: conventional IDs, delayed loading, production-host restriction
34
+
35
+ [Implementation source](https://github.com/aemsites/vg-partsasist/blob/88ef474f2d5c7bda377769d90436d6bacf96d5e2/scripts/delayed.js):
36
+
37
+ - Loads `https://cdn.cookielaw.org/scripttemplates/otSDKStub.js` in the delayed phase.
38
+ - Uses public configuration ID `078b3e5b-9ab3-4e0f-99e4-1d0b7ff41e53`.
39
+ - Only loads the SDK on hosts containing `partsasist.com`; preview hosts intentionally omit it.
40
+ - Defines `window.OptanonWrapper` and separately loads GTM.
41
+ - The observed preference center exposes `C0001` necessary, `C0002` performance, and `C0004` targeting.
42
+
43
+ In the disposable context, the following sequence was verified using the real consent controls:
44
+
45
+ | Action/state | `groups` | Interaction count | Dismissal cookie |
46
+ | --- | --- | --- | --- |
47
+ | Before interaction | `C0001:1,C0002:0,C0004:0` | `0` | absent |
48
+ | Reject All | `C0001:1,C0002:0,C0004:0` | `1` | present |
49
+ | Enable Performance only, Save settings | `C0001:1,C0002:1,C0004:0` | `2` | present |
50
+ | Accept All | `C0001:1,C0002:1,C0004:1` | `3` | present |
51
+
52
+ Rejecting all optional categories leaves the group bits identical to the unanswered defaults. Both are classified as `rejected`: this checkpoint describes the stored consent level, not whether a rejection interaction occurred.
53
+
54
+ Both `OneTrustGroupsUpdated` and `OTConsentApplied` were observed after Reject All. The cookie had already changed when those listeners ran in this SDK version. `OTConsentApplied` arrived later than the immediate post-click read, so a single early read would have missed it. Listen to both and deduplicate; do not overwrite the site's `OptanonWrapper`.
55
+
56
+ Saving preferences and accepting all caused a page reload in this deployment. Immediately after reload the stored cookie was readable before `window.OneTrust` or its injected DOM existed. This directly supports reading cookies at initialization rather than depending exclusively on SDK globals or callbacks.
57
+
58
+ `OneTrust.GetDomainData().Groups` contains more categories than the active regional preference center and cookie. It also retained the configured `Status: inactive` for Performance after Performance had been enabled. **Domain configuration is not the visitor's current consent state.**
59
+
60
+ ### CME Group: additional functional category and host-level tokens
61
+
62
+ [Implementation source](https://github.com/aemsites/cmegroup/blob/2340b7eb3867aa5afd1d6800d0582e390a1699fb/aemedge/scripts/delayed.js):
63
+
64
+ - Loads the standard OneTrust stub from the delayed script.
65
+ - Uses public configuration ID `f42915b0-68e5-491a-a7f7-1db0d962ddff`, matching the live page.
66
+ - Live configuration labels `C0003` as First-Party Functional Cookies and `C0011` as Third-Party Functional Cookies.
67
+ - `OnetrustActiveGroups` included `H...` host tokens in addition to `C0001`. The cookie's `groups` field provided a narrower category-level representation.
68
+
69
+ Do not discard `C0011` or assume there are exactly four categories. Do not substitute the active-groups global for the cookie without accounting for its additional host tokens.
70
+
71
+ ### Intuit ERP: numeric IDs and enabled defaults without interaction
72
+
73
+ [Implementation source](https://github.com/aemsites/intuit-erp/blob/0ff13f36356e52896fcd2d2eba2f20b900080e8c/plugins/tealium-martech/src/index.js):
74
+
75
+ - Loads the OneTrust stub from `privacy-cdn.a.intuit.com`, then Intuit's consent wrapper, then `gdprUtilBundle.js`.
76
+ - Uses public configuration ID `74130b76-29e2-4d72-ab52-09f9ed5818fb`, matching the live page.
77
+ - Includes its own `readOptanonConsent()` parser and waits for parseable cookie state before loading Tealium. It also listens for `OneTrustGroupsUpdated`.
78
+ - The observed regional preference center uses `1` for Essential Website Cookies and `4` for Advertising (Targeting) Cookies, not `C0001` and `C0004`.
79
+ - Its wider domain configuration labels `2` as Performance and Functionality, `3` as Analytics and Customization, and includes additional IDs such as `41`, `42`, `C0018`, and `C0024`. These were not all in the observed cookie.
80
+
81
+ Both observed bits were enabled while the interaction count was zero and the dismissal cookie was absent. The stored consent level is therefore `granted`, without claiming that the visitor clicked accept-all. Interaction evidence is not required for a sampled consent-level snapshot. Numeric IDs must not be normalized to `C000x` by assumption.
82
+
83
+ ### Canadian Tire: enabled defaults without an interaction counter
84
+
85
+ The live [Canadian Tire homepage](https://www.canadiantire.ca/en.html), selected from the RUM query, loaded the standard OneTrust stub with public configuration ID `0191bf5a-0f5d-702d-9e03-159316af06c5` and SDK version `202502.1.0`.
86
+
87
+ - Cookie groups: `C0001:1,C0004:1,C0002:1,C0003:1`.
88
+ - No `OptanonAlertBoxClosed` cookie and no `interactionCount` field.
89
+ - No banner; the preference-center markup existed.
90
+
91
+ All applicable groups were enabled, so the stored consent level is `granted` even without evidence of an explicit choice. Missing `interactionCount` must not block classification. The old banner-only plugin reported `suppressed` here; the cookie reader can report the level directly.
92
+
93
+ T-Mobile was also selected from RUM. Its homepage loaded RUM but did not expose the OneTrust cookie or SDK in this browser observation. This does not establish why other pageviews had OneTrust events, nor prove absence across its routes or regional configurations.
94
+
95
+ ## Other providers: documentation and live validation
96
+
97
+ ### TrustArc
98
+
99
+ The [vendor technical specification](https://trustarchelp.zendesk.com/hc/en-us/articles/53492086194963-Cookie-Consent-Manager-Technical-Specifications-Guide) describes different formats:
100
+
101
+ - `notice_gdpr_prefs` lists approved category numbers, e.g. `0,1,2:`. Consent-resolution suffixes can extend this to `0,1,2::expressed,eu`.
102
+ - `notice_preferences` is the legacy inclusive slider level: `0` required, `1` functional, `2` advertising, and `3+` custom buckets. It is not an independent bitset.
103
+ - `notice_behavior` describes the configured regional notice mode, not whether the visitor took an affirmative action.
104
+ - Tracker-specific opt-outs can differ from category-level state. Category snapshots must not claim all vendors in an enabled category are enabled.
105
+
106
+ Parse the documented preference portion only; do not copy suffixes, regional values, timestamps, or UID cookies. Prefer granular preferences when available, and validate legacy-slider fallback separately. Do not assume every customer has the same number of custom buckets.
107
+
108
+ #### Enel: live rejection and partial consent
109
+
110
+ The [Enel homepage](https://www.enel.it/it-it) loads `consent.trustarc.com/notice` and `asset/notice.js`. The clean browser initially showed the banner with neither preference cookie present.
111
+
112
+ | Action | `notice_gdpr_prefs` preference portion | `notice_preferences` preference portion |
113
+ | --- | --- | --- |
114
+ | Continue without accepting | `0` | `0` |
115
+ | Enable analytics, leave advertising disabled, submit preferences | `0,1` | `1` |
116
+
117
+ The page labels bucket `1` **Cookie analitici**, rather than the generic documentation's Functional label. Thus even TrustArc's category semantics need site-aware mapping; retain the category number instead of universally relabeling it. Both preference cookies were readable from the top-level document after the real UI actions.
118
+
119
+ ### Usercentrics
120
+
121
+ The [vendor's GTM template](https://github.com/Usercentrics/gtm-templates-usercentrics-cmp/blob/main/template.tpl) reads localStorage `uc_gcm` JSON and uses these properties:
122
+
123
+ - `adStorage`
124
+ - `analyticsStorage`
125
+ - `adPersonalization`
126
+ - `adUserData`
127
+
128
+ Values feed Google Consent Mode (`granted`/`denied`). This is a subset of consent signals, not necessarily the complete Usercentrics service/category decision or proof of explicit interaction. A future reader should accept only known keys/values, catch malformed JSON and denied storage access, and never forward the entire object.
129
+
130
+ #### Openbank: Google Consent Mode storage present after rejection
131
+
132
+ The live [Openbank homepage](https://www.openbank.de/) loaded Usercentrics UI `3.113.0` and SDK `4.66.2`, with public settings ID `jBQVAAZ_9`.
133
+
134
+ - Before interaction, its shadow-root banner was visible and `uc_gcm` was absent.
135
+ - Clicking **Alle ablehnen** hid the banner and created `uc_gcm`, with all four documented signals set to `denied`.
136
+
137
+ This verifies that `uc_gcm` presence cannot mean acceptance: it also represents rejection.
138
+
139
+ #### Hamleys: no `uc_gcm`, but customer-defined category cookies
140
+
141
+ The live [Hamleys homepage](https://www.hamleys.com/) loaded Usercentrics UI `3.113.0`, with public settings ID `YXJdSJPySRDK4E`.
142
+
143
+ - Before interaction, the banner was visible and `uc_gcm` was absent.
144
+ - Clicking **ACCEPT** hid the banner, but `uc_gcm` remained absent.
145
+ - Five first-party cookies were present with literal `true` values: `uc_consent_status_functional`, `uc_consent_status_marketing`, `uc_consent_status_analytics`, `uc_consent_status_personalisation`, and `uc_consent_status_essential`.
146
+ - An injected GTM script explicitly writes these cookies and pushes a `consent_status_update` data-layer event. These are **customer integration cookies**, not evidence of a universal Usercentrics cookie format.
147
+ - Standard localStorage `uc_settings` was present. Structural inspection found `services[].status` booleans, but also controller IDs and consent-history timestamps. No identifying values were exported.
148
+
149
+ A generic implementation must not depend solely on `uc_gcm`, assume these five Hamleys cookies exist everywhere, or forward `uc_settings`. Supporting complete Usercentrics state needs a vetted reader for its documented service storage, or explicit integration-specific category-cookie mappings. The legacy banner plugin can classify an accepted Hamleys visit as `suppressed` once its UI is gone because it only recognizes `uc_gcm` as stored state. The exact cause of each historical `suppressed` event remains unproven.
150
+
151
+ ## Implemented checkpoint contract
152
+
153
+ The requested contract is three new **target values on the existing `consent` checkpoint**, not a new checkpoint, new payload fields, or versioned state strings:
154
+
155
+ - `granted`: all supported optional categories/signals enabled.
156
+ - `rejected`: all supported optional categories/signals disabled.
157
+ - `customized`: a mix of enabled and disabled optional categories/signals.
158
+
159
+ Provider sources remain unchanged. A recognized stored level replaces the old banner-only target for that page; otherwise `show`, `hidden`, and `suppressed` remain fallback values. No cookie contents, IDs, counters, timestamps, or per-category bits are sent. Since the enhancer runs on sampled pageviews, classification does not require observation of a consent interaction or an interaction-evidence marker.
160
+
161
+ The implementation retains the existing once-per-page snapshot. `OptanonConsent`-only and supported Usercentrics category-cookie-only discovery work before SDK initialization. Change-event listeners are not part of this change.
162
+
163
+ Classification remains provider-specific:
164
+
165
+ - OneTrust reads `groups` without requiring a dismissal cookie or consulting `interactionCount`. Pending reconsent remains unclassified. It excludes the necessary `C0001` or numeric `1` group and requires at least one optional category. Other necessary-category schemes remain unsupported.
166
+ - TrustArc supports the standard three-bucket schema, preferring the granular list over the legacy slider. Custom bucket values are left unclassified; the cookie does not enumerate all denied custom buckets, so this is not a general custom-schema decoder.
167
+ - Usercentrics uses complete GCM signals, or the explicitly supported category-cookie integration observed at Hamleys when GCM storage is absent. It ignores `uc_user_interaction`, does not read full `uc_settings`, and does not infer arbitrary cookie-prefix semantics. GCM results describe those four signals, not every service configured in the CMP.
168
+
169
+ Malformed or incomplete values, duplicate category IDs/cookies, blocked storage, and unsupported formats fall back rather than inventing a grant or rejection. Inputs are bounded and only fixed target strings leave the parsers. The existing collector checkpoint and payload-field schemas remain unchanged.
170
+
171
+ ### Regression coverage
172
+
173
+ - PartsASIST unanswered vs rejected: identical groups produce the same `rejected` level regardless of interaction evidence.
174
+ - All three levels are reported without a dismissal cookie, with absent/zero/invalid interaction counters, and with `uc_user_interaction=false`.
175
+ - Stored partial and all-enabled state before the SDK exists.
176
+ - Intuit numeric IDs, enabled defaults, no dismissal cookie.
177
+ - CME custom `C0011` and differences between domain configuration, active globals, and cookie categories.
178
+ - Reconsent flag with previously enabled groups; never report an unqualified fresh grant.
179
+ - No cookie, empty cookie, invalid escaping, invalid bits, duplicate IDs, reordered groups, overlong input, and denied cookie/storage access.
180
+ - Repeated initialization still emits exactly one event; separate iframe realms test new-page snapshots.
181
+ - Exact cookie-name matching and unrelated cookies containing identifiers: no accidental inclusion in telemetry.
182
+ - TrustArc granular vs legacy formats, suffix stripping, custom buckets, and conflicting values.
183
+ - Usercentrics valid/partial/invalid `uc_gcm`, unknown keys, denied storage access, missing shadow-root UI, and completed interaction without `uc_gcm` (Hamleys).
184
+ - Canadian Tire's missing interaction counter and Enel's site-specific category labels.
185
+ - Customer-defined consent-cookie mappings must be opt-in or explicitly supported, not guessed from an arbitrary prefix.
186
+ - Existing banner-state tests remain unchanged; the new targets survive provider discovery and the actual beacon serializer without any raw consent data.
187
+
188
+ ## BigQuery and ingestion findings
189
+
190
+ - `helix_rum.cluster_all` is a `UNION ALL` of `cluster` and `cluster_cloudflare`. Both backing tables are partitioned daily on `time` and clustered by `hostname`.
191
+ - The live schema has `checkpoint`, `source`, and `target` string columns. It does not have arbitrary consent-level/category columns.
192
+ - A dry run of the 2026-11-12 UTC hostname aggregation estimated 15,722,888,453 bytes. Two read-only executions each used a 25 GiB cap and processed two partitions: the second retrieved the full aggregate result after the first CLI output limit omitted the recognized providers. Neither execution hit the query cache; each processed 15,722,888,453 bytes. The revised allowlisted query was separately dry-run validated.
193
+ - The raw provider field contained scanner-like strings, not just CMP names. These values were treated as untrusted data, excluded from customer selection, and are not copied into repository artifacts. The reusable [query](queries/consent-hosts.sql) restricts providers and the six known consent target values explicitly.
194
+ - Rankings use sampled event counts; `SUM(weight)` is a weighted event estimate, **not** a unique-visitor count or consent-grant rate. Existing `hidden`/`suppressed` events cannot answer what consent was granted.
195
+ - [Collector source at `3da9395`](https://github.com/adobe/helix-rum-collector/blob/3da93958e2c2e3d5dbcaf939ef0ef3af0d19e886/src/utils.mjs) explicitly allows `consent` but not `consentstate`. The Google logger validates checkpoints and sanitizes `source`/`target`. Local bundler inspection shows generic events retain these fields. No new telemetry payload was submitted to production to test this.
196
+
197
+ Example dry run of the reusable query:
198
+
199
+ ```sh
200
+ bq --project_id=helix-225321 --location=US query \
201
+ --use_legacy_sql=false --dry_run \
202
+ --maximum_bytes_billed=26843545600 \
203
+ --parameter='start_time:TIMESTAMP:2026-11-12 00:00:00+00' \
204
+ --parameter='end_time:TIMESTAMP:2026-11-13 00:00:00+00' \
205
+ < docs/queries/consent-hosts.sql
206
+ ```
207
+
208
+ Remove `--dry_run` only after reviewing the estimate. No raw production traffic counts or individual RUM rows are stored in this repository.
209
+
210
+ ## Out of scope / future work
211
+
212
+ - Same-page consent-change notifications and revocation events; this change preserves the original snapshot timing.
213
+ - General custom necessary-category mappings and custom TrustArc bucket universes.
214
+ - Usercentrics service-level storage beyond GCM and the specifically supported category cookies.
215
+ - Additional geographic variants. No new telemetry was injected into production to test the collector.
216
+
217
+ Do not select page/session identifiers, full URLs with query strings, or user-level rows for this investigation; hostname-level aggregates are sufficient.
@@ -0,0 +1,37 @@
1
+ -- BigQuery Standard SQL. Supply start_time and end_time TIMESTAMP parameters.
2
+ -- Dry-run first and set maximum_bytes_billed when executing.
3
+ -- Use a narrow window (e.g. one complete UTC day) to prune both backing tables.
4
+ -- These are event counts, not unique visitors, sessions, or consent acceptance rates.
5
+ WITH counts AS (
6
+ SELECT
7
+ source AS provider,
8
+ hostname,
9
+ target AS consent_state,
10
+ COUNT(*) AS sampled_events,
11
+ SUM(weight) AS weighted_events
12
+ FROM `helix-225321.helix_rum.cluster_all`
13
+ WHERE time >= @start_time
14
+ AND time < @end_time
15
+ AND checkpoint = 'consent'
16
+ -- The raw fields are untrusted and can contain scanner-generated values.
17
+ AND source IN ('onetrust', 'trustarc', 'usercentrics')
18
+ AND target IN ('show', 'hidden', 'suppressed', 'granted', 'rejected', 'customized')
19
+ GROUP BY provider, hostname, consent_state
20
+ ), hosts AS (
21
+ SELECT
22
+ provider,
23
+ hostname,
24
+ SUM(sampled_events) AS sampled_events,
25
+ SUM(weighted_events) AS weighted_events,
26
+ ARRAY_AGG(
27
+ STRUCT(consent_state, sampled_events, weighted_events)
28
+ ORDER BY sampled_events DESC, consent_state
29
+ ) AS states
30
+ FROM counts
31
+ GROUP BY provider, hostname
32
+ )
33
+ SELECT * FROM hosts
34
+ QUALIFY ROW_NUMBER() OVER (
35
+ PARTITION BY provider ORDER BY sampled_events DESC, hostname
36
+ ) <= 12
37
+ ORDER BY provider, sampled_events DESC, hostname;
@@ -0,0 +1,49 @@
1
+ /*
2
+ * Copyright 2026 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ // Read only the requested value. Storage can be unavailable in sandboxed documents.
14
+ export function getCookie(name) {
15
+ try {
16
+ const matches = document.cookie.split(';').map((c) => c.trim())
17
+ .filter((c) => c.startsWith(`${name}=`));
18
+ if (!matches.length) {
19
+ return undefined;
20
+ }
21
+ // null distinguishes an ambiguous cookie from an absent one (undefined).
22
+ return matches.length === 1 ? matches[0].slice(name.length + 1) : null;
23
+ } catch {
24
+ return undefined;
25
+ }
26
+ }
27
+
28
+ export function getLocalStorage(name) {
29
+ try {
30
+ return window.localStorage.getItem(name);
31
+ } catch {
32
+ return null;
33
+ }
34
+ }
35
+
36
+ // Required categories must be removed by the provider before calling this helper.
37
+ // Incomplete, ambiguous or empty sets must not become a grant or a rejection.
38
+ export function classifyConsent(choices) {
39
+ if (!choices.length || choices.length > 64 || choices.some((v) => typeof v !== 'boolean')) {
40
+ return undefined;
41
+ }
42
+ if (choices.every(Boolean)) {
43
+ return 'granted';
44
+ }
45
+ if (choices.some(Boolean)) {
46
+ return 'customized';
47
+ }
48
+ return 'rejected';
49
+ }
package/modules/index.js CHANGED
@@ -15,6 +15,7 @@ import { KNOWN_PROPERTIES, DEFAULT_TRACKING_EVENTS } from './defaults.js';
15
15
  import { urlSanitizers } from './utils.js';
16
16
  import { targetSelector, sourceSelector, untrustedClickPayload } from './dom.js';
17
17
  import { fflags } from './fflags.js';
18
+ import { getCookie, getLocalStorage } from './consent.js';
18
19
 
19
20
  const { sampleRUM, queue, isSelected } = (window.hlx && window.hlx.rum) ? window.hlx.rum
20
21
  /* c8 ignore next */ : {};
@@ -27,7 +28,7 @@ const createMO = (cb) => (window.MutationObserver ? new MutationObserver(cb)
27
28
  const [blocksMO, mediaMO] = [blocksMCB, mediaMCB].map(createMO);
28
29
 
29
30
  // Check for the presence of a given cookie
30
- const hasCookie = (key) => document.cookie.split(';').some((c) => c.trim().startsWith(`${key}=`));
31
+ const hasCookie = (key) => getCookie(key) !== undefined;
31
32
 
32
33
  // Set the base path for the plugins
33
34
  const pluginBase = new URL(document.currentScript.src).href.replace(/index(\.map)?\.js/, 'plugins');
@@ -35,7 +36,7 @@ const pluginBase = new URL(document.currentScript.src).href.replace(/index(\.map
35
36
  const CONSENT_PROVIDERS = [
36
37
  {
37
38
  name: 'onetrust',
38
- detect: () => hasCookie('OptanonAlertBoxClosed') || document.querySelector('#onetrust-banner-sdk, #onetrust-pc-sdk'),
39
+ detect: () => ['OptanonAlertBoxClosed', 'OptanonConsent'].some(hasCookie) || document.querySelector('#onetrust-banner-sdk, #onetrust-pc-sdk'),
39
40
  },
40
41
  {
41
42
  name: 'trustarc',
@@ -43,7 +44,7 @@ const CONSENT_PROVIDERS = [
43
44
  },
44
45
  {
45
46
  name: 'usercentrics',
46
- detect: () => window.localStorage.getItem('uc_gcm') || document.querySelector('#usercentrics-root'),
47
+ detect: () => getLocalStorage('uc_gcm') || hasCookie('uc_consent_status_essential') || document.querySelector('#usercentrics-root'),
47
48
  },
48
49
  ];
49
50
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.51.0",
3
+ "version": "2.52.0",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -33,7 +33,7 @@
33
33
  "reporter-options": "configFile=.mocha-multi.json"
34
34
  },
35
35
  "devDependencies": {
36
- "@adobe/eslint-config-helix": "3.0.33",
36
+ "@adobe/eslint-config-helix": "3.0.34",
37
37
  "@adobe/helix-rum-js": "2.17.0",
38
38
  "@adobe/rollup-plugin-checksum": "1.2.0",
39
39
  "@eslint/config-helpers": "0.7.0",
@@ -60,7 +60,7 @@
60
60
  "lint-staged": "17.6.0",
61
61
  "mocha": "12.0.3",
62
62
  "mocha-multi-reporters": "1.5.2",
63
- "rollup": "4.64.5",
63
+ "rollup": "4.67.2",
64
64
  "rollup-plugin-eslint-bundle": "9.0.0",
65
65
  "semantic-release": "25.0.9",
66
66
  "semantic-release-slack-bot": "^4.0.2",
@@ -9,12 +9,55 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
- function trackConsent() {
13
- const cmpCookie = document.cookie.split(';')
14
- .map((c) => c.trim())
15
- .find((cookie) => cookie.startsWith('OptanonAlertBoxClosed='));
12
+ import { getCookie, classifyConsent } from '../modules/consent.js';
16
13
 
17
- if (cmpCookie) {
14
+ function readConsent() {
15
+ const raw = getCookie('OptanonConsent');
16
+ if (!raw || raw.length > 4096) {
17
+ return null;
18
+ }
19
+ try {
20
+ // Some integrations encode the entire cookie, others just its field values.
21
+ return new URLSearchParams(raw.includes('=') ? raw : decodeURIComponent(raw));
22
+ } catch {
23
+ return null;
24
+ }
25
+ }
26
+
27
+ function getChoice(consent) {
28
+ if (!consent || consent.getAll('groups').length !== 1
29
+ || consent.getAll('AwaitingReconsent').length > 1
30
+ || ![null, 'false'].includes(consent.get('AwaitingReconsent'))) {
31
+ return undefined;
32
+ }
33
+
34
+ // Report the stored level, not evidence of an interaction on a sampled page.
35
+ const entries = consent.get('groups').split(',');
36
+ if (entries.length > 65 || entries.some((entry) => !/^(C\d{4}|\d{1,3}):[01]$/.test(entry))) {
37
+ return undefined;
38
+ }
39
+ const groups = new Map(entries.map((entry) => entry.split(':')));
40
+ if (groups.size !== entries.length) {
41
+ return undefined;
42
+ }
43
+ // The observed standard and numeric schemas use these IDs for necessary cookies.
44
+ const required = ['C0001', '1'].filter((id) => groups.has(id));
45
+ if (required.length !== 1 || groups.get(required[0]) !== '1') {
46
+ return undefined;
47
+ }
48
+ groups.delete(required[0]);
49
+ return classifyConsent([...groups.values()].map((value) => value === '1'));
50
+ }
51
+
52
+ export function getConsentTarget() {
53
+ const consent = readConsent();
54
+ const choice = getChoice(consent);
55
+ if (choice) {
56
+ return choice;
57
+ }
58
+
59
+ const closed = getCookie('OptanonAlertBoxClosed');
60
+ if (closed !== undefined && consent?.get('AwaitingReconsent') !== 'true') {
18
61
  return 'hidden';
19
62
  }
20
63
 
@@ -33,6 +76,6 @@ export default function addCookieConsentTracking({ sampleRUM }) {
33
76
  return;
34
77
  }
35
78
 
36
- sampleRUM('consent', { source: 'onetrust', target: trackConsent() });
79
+ sampleRUM('consent', { source: 'onetrust', target: getConsentTarget() });
37
80
  hasSentData = true;
38
81
  }
@@ -9,12 +9,48 @@
9
9
  * OF ANY KIND, either express or implied. See the License for the specific language
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
- function trackConsent() {
13
- const cookies = document.cookie.split(';')
14
- .map((c) => c.trim())
15
- .filter((cookie) => (cookie.startsWith('notice_gdpr_prefs=') || cookie.startsWith('notice_preferences=')));
12
+ import { getCookie, classifyConsent } from '../modules/consent.js';
16
13
 
17
- if (cookies.length === 2) {
14
+ function readPreference(raw) {
15
+ if (!raw || raw.length > 4096) {
16
+ return undefined;
17
+ }
18
+ try {
19
+ // Strip timestamps / consent-resolution suffixes; never transmit them.
20
+ return decodeURIComponent(raw).split(':')[0];
21
+ } catch {
22
+ return undefined;
23
+ }
24
+ }
25
+
26
+ function getChoice(granular, legacy) {
27
+ if (granular !== undefined) {
28
+ const value = readPreference(granular);
29
+ if (!value || !/^[012](,[012])*$/.test(value)) {
30
+ return undefined;
31
+ }
32
+ const groups = value.split(',');
33
+ if (!groups.includes('0') || new Set(groups).size !== groups.length) {
34
+ return undefined;
35
+ }
36
+ // Standard TrustArc has required (0) and two optional buckets (1, 2).
37
+ // Unknown custom buckets cannot safely be interpreted as this three-bucket schema.
38
+ return classifyConsent(['1', '2'].map((id) => groups.includes(id)));
39
+ }
40
+ // The legacy slider is inclusive, unlike the granular approved-category list.
41
+ const level = readPreference(legacy);
42
+ return /^[012]$/.test(level) ? ['rejected', 'customized', 'granted'][Number(level)] : undefined;
43
+ }
44
+
45
+ export function getConsentTarget() {
46
+ const granular = getCookie('notice_gdpr_prefs');
47
+ const legacy = getCookie('notice_preferences');
48
+ const choice = getChoice(granular, legacy);
49
+ if (choice) {
50
+ return choice;
51
+ }
52
+
53
+ if (granular !== undefined && legacy !== undefined) {
18
54
  return 'hidden';
19
55
  }
20
56
 
@@ -33,6 +69,6 @@ export default function addCookieConsentTracking({ sampleRUM }) {
33
69
  return;
34
70
  }
35
71
 
36
- sampleRUM('consent', { source: 'trustarc', target: trackConsent() });
72
+ sampleRUM('consent', { source: 'trustarc', target: getConsentTarget() });
37
73
  hasSentData = true;
38
74
  }