Skip to content

Expose completion state, raw data and page-supplied evidence on the fod object - #15

Merged
justadreamer merged 5 commits into
mainfrom
feature/fod-page-contract
Aug 5, 2026
Merged

Expose completion state, raw data and page-supplied evidence on the fod object#15
justadreamer merged 5 commits into
mainfrom
feature/fod-page-contract

Conversation

@YaroslavVlasenko

Copy link
Copy Markdown
Contributor

What

Two additions to the JavaScript template:

  1. The generated object (default name fod) now exposes two public properties alongside the existing complete() / onChange() API:
  • isComplete: false while evidence collection is in flight, true once processing has finished (successfully or not; see data.errors).
  • data: the latest raw JSON payload. Unlike the property getters it keeps missing values as null instead of the null-reason text.
  1. A page can supply extra evidence for the JSON refresh request by defining a plain string-to-string object named <ObjectName>Evidence (default fodEvidence) before the script executes. Each entry is url-encoded and appended to the form-data body of the existing POST request. The values are never written to the URL, cookies or web storage, so this is the supported way to pass sensitive evidence.

Both are documented in the README.

Why

This lets an on-page 51Degrees integration share its result with other consumers. The first consumer is the Prebid.js 51Degrees RTD module: it detects fod on the page automatically and enriches the bid request from it instead of loading a second copy of the script.
The evidence object gives pages a way to pass evidence that must not appear in a URL or persist in the browser.
Without <ObjectName>Evidence on the page the generated script behaves exactly as before.

@justadreamer
justadreamer force-pushed the feature/fod-page-contract branch from 0ca2999 to c39af8a Compare August 5, 2026 07:35
The data/isComplete work on the fod object is an independent feature: it
touches none of the request-body code and its own semantics are unsettled
(a recorded failure latches isComplete, and the complete-from-cache path
reports completion while a refresh is in flight). Taking it out leaves this
change to one concern; the public state contract can come back on its own
terms, as accessors rather than a state copy that every transition has to
remember to re-sync.
The query string of the script URL does not take precedence over the body:
its parameters are re-sent as form fields in the same body, so a duplicated
key is two form fields of the same name and the winner depends on the
server's form parsing. The "never stored" guarantee covers the evidence
values, not the response they produce, which is cached in session storage
verbatim. Also state what happens to non-string values, which the code
coerces rather than rejects.
@justadreamer
justadreamer merged commit 8539e2d into main Aug 5, 2026
1 check passed
@justadreamer
justadreamer deleted the feature/fod-page-contract branch August 5, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants