Skip to content

Build uid.js #4

Description

@patmmccann

prebid/prebid-universal-creative#315 removes user sync from puc, but is still has the uid.js build. that should be moved over here as well

codex description of what it is:

uid.js in the Prebid Universal Creative repo is not the normal ad-rendering creative. It is a small, separate helper for SSP / buyer user IDs.

What it does:

Creates window.pbs.getBuyerUids()
It exposes a browser API:

window.pbs.getBuyerUids(function(error, uids) {
// use uids here
})

The file comment says its purpose is to “return the ssp buyer user id’s.”

Calls Prebid Server’s /getuids endpoint
It uses:

https://prebid.adnxs.com/pbs/v1/getuids

with withCredentials: true, meaning cookies are sent on the request.

Caches the returned ID map in localStorage
It stores the response under:

ssp-buyeruids

and adds a lastUpdated timestamp. The localStorage helper just wraps window.localStorage.setItem() / getItem().

Refreshes every 14 days
It treats cached data as stale after 14 days:

REFRESH_IN_DAYS = 14

and reloads from /getuids if missing or expired.

Auto-runs once when loaded
The last line calls loadData(noop), so merely loading uid.js kicks off the fetch/cache behavior even if nobody calls getBuyerUids() later.

So in plain English: it fetches the browser’s Prebid Server buyer/SSP user IDs, caches them locally, and exposes them via window.pbs.getBuyerUids(). It is adjacent to cookie/user-sync workflows, not the main PUC creative renderer.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions