Skip to content

The id5 module ​

Part of the SharedID Edge specification. The general rules for modules, including consent, time limits, modules on /sync and module requests, are there.

Name id5; gvlid 131 (ID5), purposes [1], routes v1 and sync, and fetching with the hosts id5-sync.com and api.id5-sync.com. It runs only when listed in SID_MODULES, and only on adapters that can send requests to other hosts. It fetches the visitor's ID5 ID from ID5's API, with the deployment's own ID5 partner number, and returns the EIDs ID5 answers with.

  • Settings (SID_MODULE_CONFIG.id5): partner (required, an integer from 1 to 2147483647); provider (1 to 100 printable ASCII characters); endpoint (default https://id5-sync.com/gs/v2/{partner}.json, {partner} replaced; MUST be https, on the default port, without credentials or a fragment, on one of the two hosts); timeoutMs (an integer from 10 to 5000, default 300); domain (a domain, or auto, for the cache cookie); readCookie (a cookie name, default id5id; "" for none); browsers (all, the default, or webkit27). Any other key, or an invalid value, makes the module an error.
  • Denials. The module MUST NOT send a request, MUST NOT return an ID5 EID, and MUST delete its cache cookie when the browser sent it, when any of these apply: the storage decision for the SharedID isn't allowed (opt-out, GPC, COPPA, a consent provider's denial, the TC string); a us_privacy string whose third character is Y; a US section of the GPP string, listed in gpp_sid, that the gpp module's rules deny (whether or not gpp is in SID_MODULES); or a decoded TC string, whether or not GDPR applies, whose core segment lacks ID5's vendor consent (131), consent for Purpose 1, or consent or legitimate interest for at least one of Purposes 2 to 10. Where GDPR applies, core already skips the module without a readable TC string, ID5's vendor consent or consent for Purpose 1 in the core segment, and deletes the cache cookie it declares (see Modules).
  • An existing answer. When readCookie names a cookie the request carries, holding ID5's opt-out (0) or a fetch answer as JSON (maybe percent-encoded; with a pbjs object, the entry for the partner number), an opt-out deletes the cache cookie and returns nothing, and an answer's EIDs are returned; no request is sent either way.
  • The cache cookie is sid_id5_<partner>, HttpOnly, with domain (else SID_COOKIE_DOMAIN), holding unpadded base64url of UTF-8 JSON: t (when ID5 last answered, Unix seconds), r (when to ask again), e (the EIDs), s (the signature) or o: 1 (ID5's opt-out, without e or s). Its Max-Age is what's left of 30 days from t. A cache that isn't valid, has a t more than 60 seconds ahead or 30 days or more behind the clock, is ignored; its EIDs are checked as ID5's answer is. A value over 3072 characters is written without e, with r the current time. {basePath}/optout deletes it.
  • When to ask. Before r, the cached EIDs are returned (none for o: 1) and nothing is sent. From r, or with no valid cache, the module sends one request, if context.fetch is given, the platform information has a client IP that is routable and that preciseLocationDenial allows, and the request has a User-Agent of 1 to 1024 printable ASCII characters. With browsers webkit27, the User-Agent must also be Apple WebKit 27 or later (below). Otherwise it returns the cached EIDs, if any, and sends nothing. Routable: IPv4 outside 0/8, 10/8, 100.64/10, 127/8, 169.254/16, 172.16/12, 192.0.0/24, 192.0.2/24, 192.88.99/24, 192.168/16, 198.18/15, 198.51.100/24, 203.0.113/24 and 224/3; IPv6 in 2000::/3 outside 2001::/23, 2001:db8::/32, 2002::/16 and 3fff::/20. An IPv4-mapped IPv6 address is IPv4.
  • webkit27: a User-Agent containing AppleWebKit/ that is either iOS or iPadOS (iPhone, iPad or iPod as a word, and not Android) with OS <n> (OS <n>_<m>[_<p>] like Mac OS X) or Version/<n>, n at least 27, for any browser; or Macintosh with Safari/ and Version/<n>, n at least 27, and none of Chrome/, Chromium/, CriOS/, Firefox/, FxiOS/, Edg/, EdgiOS/, EdgA/, OPR/, OPT/, Opera/, SamsungBrowser/, YaBrowser/, Vivaldi/, Brave/, DuckDuckGo/ or Electron/. Anything else doesn't match. The setting changes only whether a request is sent: denials, the cache and its deletion work as with all.
  • The request: POST to the endpoint, Content-Type: application/json, with the time limit timeoutMs (core shortens it to its own limit), and the body: partner; origin sharedid-edge; v (the module's version); ts (ISO 8601); gdpr (1 when GDPR applies, else 0); gdpr_consent (the TC string), us_privacy, gpp_string and gpp_sid (comma-joined), each only when present; provider when set; domain (the request URL's host name); ua; ip (a routable IPv4 address, dotted decimal) or ipv6 (a routable IPv6 address, RFC 5952), never both, and IPv6 never as ip; puid, the SharedID, when there is one; and the cached signature, as s, or as signature when the endpoint's path starts with /ga/. Nothing else from the request.
  • The answer (status 2xx, a JSON object of at most 65,536 characters):
    • universal_uid "0", or privacy.id5_consent false: ID5's opt-out. The cache becomes { t: now, r: now + 8 hours, o: 1 }; nothing is returned.
    • Otherwise the EIDs are the eid of each value of ids, at most 4, each with a source of letters, digits, . and - (at most 100 characters, lower-cased) and at most 2 UIDs: id 1 to 512 printable ASCII characters other than 0, atype an integer from 1 to 3 (default 1), ext a JSON object of at most 512 characters. Without any, a universal_uid gives { "source": "id5-sync.com", "uids": [{ "id": <universal_uid>, "atype": 1, "ext": { "linkType": <ext.linkType> } }] } (ext only for an integer linkType from 0 to 99).
    • signature (1 to 1024 printable characters without spaces) is cached; cache_control.max_age_sec sets r to between 15 minutes and 8 hours from now (8 hours without it).
    • The EIDs are returned in eids and cached with t now.
    • Anything else (another status, no usable EID, invalid JSON): nothing new is returned; the cached EIDs are, and the cache gets r one hour from now (a new cache with t now if there was none).
    • No answer within the time limit, or a network error: the cached EIDs are returned, and the cookie isn't changed.
  • Output: eids only, never ortb2. On /sync, only the cookie is used.
  • Nothing about the request or answer is logged or reported; errors aren't returned.