Anonymised id system module - #15492
Conversation
|
Whoa there partner! This project is migrating to typescript. Consider changing the new JS files to TS, with well-defined types for what interacts with the prebid public API (for example: bid params and configuration). Thanks!
|
|
This PR introduces changes that may not work on all browsers. According to Babel, the following polyfills may be needed, and they are not automatically included:
The best way to address this is to provide good test coverage, as normal PR checks run unit tests on older browsers. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 10adcff0be
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| * IAB Global Vendor List ID | ||
| * @type {number} | ||
| */ | ||
| gvlid: GVLID, |
There was a problem hiding this comment.
Add the storage disclosure URL to the submodule
When the storageControl module is included, its default strict rule denies keyed storage reads unless module metadata has a disclosureURL with a matching disclosure; this submodule advertises the anon-cuid key through getStorageManager but never sets disclosureURL on the spec, so storage.getDataFromLocalStorage(STORAGE_KEY) is denied and the ID is never emitted for those publishers. Please expose the device-storage disclosure URL on the submodule object so metadata can authorize the read.
AGENTS.md reference: AGENTS.md:L75-L75
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
anonymisedIdSystem declares gvlid: 1116, and metadata/compileMetadata.mjs resolves the disclosure URL from the GVL when a module doesn't set one:
if (meta.disclosureURL == null && meta.gvlid != null) {
meta.disclosureURL = await getDisclosureUrl(meta.gvlid);
}
Vendor 1116 has deviceStorageDisclosureUrl registered as https://cdn1.anonymised.io/deviceStorage.json, which declares anon-cuid (type: "web", domains: ["*"]) — so storageControl matches it and the read is allowed. The disclosureURL property is an override for vendors without a GVL-registered URL (adplusIdSystem, jixieIdSystem); setting it here would take precedence over the GVL lookup and pin a URL the GVL is authoritative for. anonymisedRtdProvider already works this way — gvlid only.
There was a problem hiding this comment.
@codex op is correct, the URL is only useful in absence of a gvlid, the build process accesses the URL in the gvl
There was a problem hiding this comment.
Summary
- Documented that
disclosureURLis intentionally omitted because metadata compilation resolves the authoritative device-storage disclosure through GVL vendor ID 1116. modules/anonymisedIdSystem.jsL80-L85 - Committed the change as
35b4163(Clarify Anonymised ID disclosure resolution). - The repository has no configured Git remote, and the required
make_prtool is unavailable in this environment, so a pull request could not be created.
Testing
- ✅
npx eslint modules/anonymisedIdSystem.js --cache --cache-strategy content - ✅
npx gulp test --nolint --file test/spec/modules/anonymisedIdSystem_spec.js(35 tests completed in both feature configurations) - ✅
git diff --check - ✅
git status --short --branch(clean working tree)
There was a problem hiding this comment.
Pull request overview
Adds a new User ID submodule (anonymisedIdSystem) to expose an Anonymised Marketing Tag identifier as an OpenRTB Extended ID (EID) with source anonymised.io, including docs, typings, and unit tests.
Changes:
- Introduces
modules/anonymisedIdSystem.jsuserId submodule that readslocalStorage["anon-cuid"], validates it, and emits an EID mapping foranonymised.io. - Adds TypeScript augmentation for the userId spec and comprehensive unit tests for validation/decoding/EID output.
- Updates userId documentation and registers the submodule in
modules/.submodules.json.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/spec/modules/anonymisedIdSystem_spec.js | Adds unit coverage for getId/decode validation and EID output. |
| modules/userId/userId.md | Documents how to configure the new anonymisedId submodule (without storage). |
| modules/userId/eids.md | Adds anonymised.io example entry to the generated EIDs documentation. |
| modules/anonymisedIdSystem.md | Adds module documentation (usage, constraints, and disclosure notes). |
| modules/anonymisedIdSystem.js | Implements the new User ID submodule and EID mapping. |
| modules/anonymisedIdSystem.d.ts | Adds userId spec TypeScript augmentation for anonymisedId. |
| modules/.submodules.json | Registers anonymisedIdSystem as a known submodule. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Barecheck - Code coverage reportTotal: 91.2%Your code coverage diff: 0.01% ▴ ✅ All code changes are covered |
Type of change
Description of change
Adds anonymisedIdSystem, a User ID submodule that exposes the Anonymised user identifier to bid adapters as an OpenRTB Extended ID under the source anonymised.io.
The submodule makes no network request and loads no script. The Anonymised Marketing Tag, which the publisher already runs on the page, stores the identifier in localStorage under the key anon-cuid; getId reads that key through getStorageManager, validates it, and returns it. When the tag is absent or the user is not signed in there is no key, and no EID is added.
Anonymised already maintains anonymisedRtdProvider (same vendor, GVL ID 1116), which carries contextual segments. This submodule handles user identity only, in line with the separation the User ID and RTD frameworks draw.
Testing
npx gulp test --file test/spec/modules/anonymisedIdSystem_spec.js # 31 tests passingnpx eslint modules/anonymisedIdSystem.js modules/anonymisedIdSystem.d.tstest/spec/modules/anonymisedIdSystem_spec.js # cleanCoverage spans every branch of getId and decode, the EID output shape via createEidsArray, and the warning behaviour.
Verified end-to-end on integrationExamples/gpt/hello_world.html with a build of userId,anonymisedIdSystem, and separately against a live auction, where the identifier appears in the outgoing bid request:
{ "eids": [ { "source": "anonymised.io", "uids": [{ "id": "01f6a483-86fa-406b-a7c2-45f6d4a89469", "atype": 1 }] } ] }Other information
Documentation PR