adQuery ID System: resolve qid synchronously without backend round-trip#15326
adQuery ID System: resolve qid synchronously without backend round-trip#15326adzida-adquery wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b76790f2e
ℹ️ 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".
| if (!qid) { | ||
| if (window.crypto && window.crypto.getRandomValues) { | ||
| const randomValues = Array.from(window.crypto.getRandomValues(new Uint32Array(4))); | ||
| qid = randomValues.map(val => val.toString(36)).join('').substring(0, 20); |
There was a problem hiding this comment.
Preserve existing window qid before generating
When no value is in localStorage but an integration has already populated window.qid, this new branch now goes straight to random generation. The previous flow used window.qid as the qid sent to Adquery’s /prebid/qid endpoint, so deployments that share an existing Adquery ID through that global will now persist and send a different EID on first load. Read window.qid before generating a new value.
Useful? React with 👍 / 👎.
Barecheck - Code coverage reportTotal: 96.56%Your code coverage diff: 0.01% ▴ Uncovered files and lines
|
Type of change
Description of change
Previously, adqueryIdSubmodule.getId() made an async ajax call to https://bidder.adquery.io/prebid/qid to fetch the qid. The client-side fallback id was only persisted to localStorage after the backend responded — if the
request failed or returned no qid, nothing was saved and the id could be regenerated on every call.
getId() is now fully synchronous, with no backend round-trip: