@adobe/helix-rum-enhancer 2.51.1 → 2.53.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/.releaserc.cjs CHANGED
@@ -3,15 +3,13 @@ module.exports = {
3
3
  "@semantic-release/commit-analyzer",
4
4
  "@semantic-release/release-notes-generator",
5
5
  ["@semantic-release/changelog", {
6
- "changelogFile": "CHANGELOG.md",
6
+ "changelogFile": "release-notes.md",
7
7
  }],
8
8
  "@semantic-release/npm",
9
- ["@semantic-release/git", {
10
- "assets": ["package.json", "package-lock.json", "CHANGELOG.md"],
11
- "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
12
- }],
13
9
  ["@semantic-release/github", {
14
10
  "assets": [
11
+ { "path": "release-notes.md", "label": "Release notes" },
12
+ { "path": "release-manifest.json", "label": "Release manifest (SHA-384 of every served file)" },
15
13
  {
16
14
  "path": "src/index.js",
17
15
  "label": "RUM Enhancer JS"
@@ -27,7 +25,8 @@ module.exports = {
27
25
  ]
28
26
  }],
29
27
  ["@semantic-release/exec", {
30
- "publishCmd": "./tagger.sh ${nextRelease.version} src/index.js src/plugins/cwv.js src/plugins/form.js src/plugins/martech.js src/plugins/onetrust.js src/plugins/video.js src/plugins/webcomponent.js --push"
28
+ "verifyReleaseCmd": "./tagger.sh ${nextRelease.version} --check",
29
+ "publishCmd": "./tagger.sh ${nextRelease.version} --manifest release-manifest.json package.json package-lock.json release-notes.md --push"
31
30
  }],
32
31
  ["semantic-release-slack-bot", {
33
32
  notifyOnSuccess: true,
package/CHANGELOG.md CHANGED
@@ -1,3 +1,36 @@
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
+
1
34
  ## [2.51.1](https://github.com/adobe/helix-rum-enhancer/compare/v2.51.0...v2.51.1) (2026-11-14)
2
35
 
3
36
 
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,92 @@
1
+ # CI and release authorization
2
+
3
+ ## Selected authorization model
4
+
5
+ - npm publication uses OIDC through a trusted publisher requiring the GitHub `release` environment. `main` needs no npm token; `1.x` is frozen (see below).
6
+ - GitHub API calls (releases, comments) use the job's short-lived `github.token` / `GITHUB_TOKEN`. All git pushes in the release job (`release-*` branches and semantic-release's `vX.Y.Z` tags) use a short-lived token from the private publisher App, minted inside the `release` environment. No `adobe-bot`, PAT or `RELEASE_GITHUB_TOKEN`.
7
+ - Build/test jobs default to read-only repository access. Only publishing jobs request the write permissions needed for tags, GitHub releases and release-branch updates. Metadata helpers retain their explicit, narrower permissions.
8
+ - Stored provider/notification credentials belong in the corresponding protected environment, never a shared publishing credential exposed to branch CI.
9
+
10
+ ## Explicit publication pause
11
+
12
+ The repository variable `RELEASE_ENABLED` must compare equal to `true` for normal publication. It remains false during this migration. Unset/false skips publication while ordinary tests continue. Collector CI deployment and maintenance have independent `CI_DEPLOY_ENABLED` and `MAINTENANCE_ENABLED` switches.
13
+
14
+ These switches are operational controls, not authorization boundaries. Exact ref guards and environment branch policies remain required. Keep all switches false until the appropriate reviewed path has been validated.
15
+
16
+ ## Source branches and generated metadata
17
+
18
+ Releases do not commit version/changelog changes back to `main` or `1.x`. The `@semantic-release/git` plugin is removed. npm's prepare step can update package metadata in the ephemeral release workspace, but no source-branch push is made.
19
+
20
+ Release-local notes are generated in `release-notes.md`, attached to the GitHub release, and included in the artifact branches where those are published. The generated file is cleared before each CI release. GitHub Releases/npm version metadata are authoritative; the source branch's historical `CHANGELOG.md` and package version are no longer automatically maintained by a publishing account.
21
+
22
+ No publisher gets a PR-review or force-push bypass on source branches. The old `adobe-bot` review allowances are removed. Repository review requirements remain enabled for administrators as well.
23
+
24
+ ## Preserved AEM delivery path and release-branch writer
25
+
26
+ The tagger-backed 2.x publication path remains:
27
+
28
+ `release-* branches → AEM Code Sync → aem.live`
29
+
30
+ Only the private GitHub App **helix-rum-release-publisher** may create, update or force-update `release-*` branches. Deletion remains blocked, and the App has no bypass on `main` or `1.x`. It has repository contents read/write only, and is installed only on helix-rum-js and helix-rum-enhancer.
31
+
32
+ The release job and the canary mint a short-lived installation token with `actions/create-github-app-token` (pinned by commit SHA). They use the App client ID from the `release` environment variable `RELEASE_APP_CLIENT_ID` and the private key from the `release` environment secret `RELEASE_APP_PRIVATE_KEY`. The token is scoped to the current repository with `contents: write` and revoked when the job ends. Checkout persists it, so `tagger.sh` pushes release branches as the App. GitHub API calls (releases, issue and PR comments) still use the job's `GITHUB_TOKEN`.
33
+
34
+ Why not `GITHUB_TOKEN`: GitHub does not honor the GitHub Actions identity in branch push allowances or ruleset bypass lists. The first canary run failed with GH006 for this reason. Ordinary workflows with `contents: write` therefore cannot write `release-*`; only jobs that can read the `release` environment's key can, and that environment only admits `main`.
35
+
36
+ Checkout persists the App token for the whole release job, so semantic-release's `vX.Y.Z` tag push also goes out as the App. As of 18 November 2026, no tag protection or tag ruleset exists in helix-rum-js or helix-rum-enhancer (the only ruleset targets exact `release-*` branches). If a tag ruleset is added, it must allow `helix-rum-release-publisher`. The delivery canary exercises only the `release-*` path; the first real release exercises the tag push.
37
+
38
+ App-token pushes of both release branches and tags trigger ordinary `push` workflows, as the old bot pushes did; on `main`, the release job's `if:` and `.releaserc.cjs` `branches` name only `main`. A push runs the workflow files of the branch it lands on, and the frozen `1.x` branch's own copies still name `1.x`. What stops a 1.x release is the branch lock and the `release` environment admitting only `main`, not `main`'s configuration. AEM Code Sync is an external integration; check delivery with the canary workflow before relying on this path.
39
+
40
+ To rotate the key: generate a new private key in the App settings, pipe it into both repositories' `release` environment secret, then delete the old key in the App settings.
41
+
42
+ ## Validation
43
+
44
+ `npm run test-release` loads the release configuration and resolves every plugin without publishing credentials. It also verifies there is no source-commit plugin or obsolete credentialed dry-run script. The tagger-backed packages additionally run local bare-Git tests for ref names, dirty/detached worktrees, missing/unsafe artifacts, atomic failure and stale leases.
45
+
46
+ Run the normal lint/browser/Node suites and `actionlint .github/workflows/*` as well. No validation command should reintroduce a publishing token into branch tests.
47
+
48
+ ## Release environment
49
+
50
+ Allow only reviewed `main`. Keep the npm trusted publisher bound to environment `release` and keep bypass-2FA npm tokens disallowed. No npm secret is required. The only GitHub credential is the publisher App key described above. Existing Slack notification credentials, if used, are a separate environment-scoped integration.
51
+
52
+ ### Tagger-backed publication
53
+
54
+ For the 2.x workflows, `tagger.sh` starts from the checked-out source commit and adds only explicitly listed generated files using an isolated Git index. It does not check out another branch, reset source history, borrow staged changes or modify the working tree.
55
+
56
+ - A stable version such as 2.3.4 updates `release-2-3-4`, `release-2-3-x` and `release-2-x` to one artifact commit.
57
+ - A prerelease updates only its normalized exact branch.
58
+ - With `--push`, remote refs are updated atomically using explicit per-ref leases. A rejected or concurrently changed ref fails the whole push; there is no partial/sequential fallback.
59
+ - Without `--push`, local refs are updated transactionally for inspection. Checked-out release refs are refused.
60
+ - Earlier exact versions are left alone by a newer release. This is not a write-once guarantee: deliberately republishing the same version can still rewrite its exact branch through the publisher App.
61
+ - Normal git/npm release tags remain semantic-release's responsibility. The tagger only publishes generated branches.
62
+
63
+ ### Live authentication/Code Sync smoke test
64
+
65
+ After this workflow is merged to main, manually run **Verify release-branch delivery** (`verify-release-auth.yml`). It can run while normal publication is paused, from reviewed main in the release environment.
66
+
67
+ It writes a unique `release-0-0-0-auth-<run-id>` branch containing a harmless source/run marker, then verifies the bytes delivered by the corresponding `aem.live` URL with bounded retries. It does not publish npm packages, alter stable version aliases or enable any publication switch. It retains the canary branch; deleting it requires a deliberate maintainer action under the no-deletion policy.
68
+
69
+ This workflow exists on the tagger-backed 2.x mainline only.
70
+
71
+ ## Frozen 1.x
72
+
73
+ `1.x` is frozen. Its branch protection has **Lock branch** enabled, which makes it read-only for everyone, administrators included. The `release` environment no longer admits `1.x`, so no run on `1.x` can use npm OIDC or the publisher App key. The last 1.x release stays as published (helix-rum-enhancer 1.23.1, npm dist-tag `release-1.x`). `1.x` also contains an unreleased runtime change (`b2769db`, OneTrust consent tracking for all sites, from #266); it will not ship. Renovate's `baseBranches` is `main` only.
74
+
75
+ To unfreeze, a maintainer must deliberately do all of these; skipping one leaves 1.x silently half-working:
76
+
77
+ 1. Disable **Lock branch** on the `1.x` branch protection rule.
78
+ 2. Add `1.x` back to the `release` environment's deployment branch policy.
79
+ 3. Check that the `1.x` branch's own `.github/workflows/main.yaml` (release job `if:`) and `.releaserc.cjs` (`branches`) still admit `1.x`; they do today. Pushes to `1.x` use those copies, not `main`'s.
80
+ 4. Add `1.x` to Renovate's `baseBranches` in `.renovaterc.json` (with `main`), so the branch gets dependency updates again.
81
+
82
+ ## Backfilling release branches from npm
83
+
84
+ Older taggers published only some built files to the `release-*` branches, and no `release-1-x` alias existed. The collector served the gaps from jsDelivr/unpkg. **Backfill release branch from npm** (`backfill-release.yml`, manual, `main` only, `release` environment) repairs a branch from the published package:
85
+
86
+ - the tarball must match the registry's sha512 `integrity`;
87
+ - the branch must be `release-<version>`, or `release-<major>-x` for the newest `<major>.x` release;
88
+ - an existing branch only gets the built `.js` files it lacks (debug `*.map.js` builds are skipped); if any file it already serves differs from npm, nothing is pushed;
89
+ - a new branch starts from the `v<version>` tag and gets the package's built files and `package.json`;
90
+ - the push uses the publisher App token. Without the `push` input, it only prints the plan.
91
+
92
+ Exact `release-X-Y-Z` branches are write-once, so repairing one also needs a deliberate, temporary exclusion of that ref from the **Write-once exact release branches** ruleset, removed right after.
@@ -0,0 +1,38 @@
1
+ # Release manifest and write-once releases
2
+
3
+ ## Manifest
4
+
5
+ Every release publishes `release-manifest.json`:
6
+
7
+ ```json
8
+ {
9
+ "schema": 1,
10
+ "package": "@adobe/helix-rum-enhancer",
11
+ "version": "X.Y.Z",
12
+ "source": { "commit": "<git sha of main>" },
13
+ "files": {
14
+ "src/<file>.js": { "integrity": "sha384-<base64>", "size": 1234 }
15
+ }
16
+ }
17
+ ```
18
+
19
+ - `files` lists **every `.js` file the build writes under `src/`**, derived from the build output rather than a hand-maintained list. `integrity` uses the same format as Subresource Integrity, so it can be used directly in an `integrity` attribute.
20
+ - It's generated in `prepack`, right after the build that npm publishes, by `node release-manifest.mjs write`.
21
+ - It's attached to the GitHub release. **GitHub release immutability is enabled** for this repository, so that copy can't be changed after publication: it is the approved reference for monitors and the collector.
22
+ - It's also included in the `release-*` artifact branches (served via aem.live) and in the npm tarball.
23
+
24
+ `tagger.sh --manifest release-manifest.json` verifies, before changing any ref, that the manifest matches this version and the commit being published (`source.commit` must equal `HEAD`), that every built file is listed, and that every listed file's digest matches the bytes on disk. It then publishes exactly those files plus the manifest.
25
+
26
+ To check a served file by hand, compare the **decoded** bytes; aem.live always sends gzip:
27
+
28
+ ```sh
29
+ curl -s --compressed https://release-X-Y-Z--helix-rum-enhancer--adobe.aem.live/<path> | openssl dgst -sha384 -binary | base64
30
+ ```
31
+
32
+ ## Write-once exact releases
33
+
34
+ A repository ruleset, **Write-once exact release branches**, covers `refs/heads/release-[0-9]*-[0-9]*-[0-9]*`, which is every exact version and prerelease branch. It blocks updates, force pushes and deletion, with **no bypass actors**, administrators included. Creating a new exact branch is still allowed for the publisher App, through the classic `release-*` protection. Alias branches such as `release-2-x` and `release-2-17-x` aren't matched and keep moving to the newest release.
35
+
36
+ `tagger.sh` also refuses to publish when the exact branch already exists. semantic-release runs `tagger.sh <version> --check` in its **verifyRelease** step, before npm or GitHub publish anything, so an existing exact branch stops the whole release instead of failing after npm has already published.
37
+
38
+ Branch names replace every non-alphanumeric character with `-`, so `tagger.sh` only accepts versions for which that is reversible: no build metadata (`+...`) and no `-` inside prerelease identifiers (`2.4.0-rc.1` is fine, `2.4.0-rc-1` is rejected). Every version published so far meets this.
@@ -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