The clickid module
Part of the SharedID Edge specification. The general rules for modules, including consent, time limits and modules on /sync, are there.
Name clickid; no gvlid, and no declared purposes (it checks Purposes 1 and 7 itself, below, so it can delete what it stored). It runs only when listed in SID_MODULES. It keeps ad click IDs from the landing page's URL in server-set first-party cookies, so a conversion on a later page view or visit can be attributed.
Settings,
SID_MODULE_CONFIG.clickid, every key optional:params: a list of entries{ "name", "cookie"?, "enabled"? }. The default parameters aregclid,gbraid,wbraid,dclid,fbclid,msclkidandttclid, in that order, each kept in the cookie_sid_<name>. An entry whosenameis a default parameter changes it; any other entry adds a parameter after the defaults, in list order.name(required) is a query parameter name matching^[A-Za-z][A-Za-z0-9_-]{0,63}$, matched case-sensitively, and MUST NOT repeat in the list.cookie(default_sid_<name>), given or defaulted, is a cookie name (an RFC 6265 token, at most 64 characters) and MUST NOT be_pubcid,_pubcid_sv,_pubcid_optout,ts-ec,euconsent-v2or_sid_keep(nor, as for every module, the worker's configured cookie names).enabled(defaulttrue) set tofalseturns the parameter off. At most 20 parameters may be enabled, and no two may use the same cookie;maxAgeDays(default90): an integer from 1 to 400;domain: a registrable domain without a leading dot, such asexample.com, and the cookies getDomain=.<domain>; orhost-only, and they get noDomainattribute whateverSID_COOKIE_DOMAINsays; orauto, and they get the domain Prebid.js reports on the request (cookie_domain, checked against the host as forSID_COOKIE_DOMAIN=auto), else noDomain, whateverSID_COOKIE_DOMAINsays; a deletion (on opt-out, or when storage isn't allowed) goes to the host and every domain above it. Without it,SID_COOKIE_DOMAINapplies;httpOnly(defaultfalse);hosts: up to 20 lower-case hostnames, besides the request's own, whose URLs are read (a browser request from another site is refused whatever its URL, below).
Any other key, a wrong type or an out-of-range value makes the module an
erroron every call, with no details; error messages MUST NOT contain configured values.The landing URL is the request's
urlquery parameter when it's present and non-empty, else itsRefererheader. It's used only when it parses as an absolutehttporhttpsURL whose host, compared case-insensitively, is the request's own host or one ofhosts; otherwise there's no landing URL and nothing is stored. There's also none when the request comes from another site: it hasSec-Fetch-Site: cross-site, or a non-emptyRefererthat isn't such a URL (even when theurlparameter is used). Aurlnaming an allowed host says nothing about where the request came from, so without this a link on another site to{basePath}/v1?url=…could plant a click ID. On/sync(Prebid.js'spixelUrl, an image request from the page) theRefereris the landing page under the browser's default referrer policy.Click IDs: for each enabled parameter, the first value of that parameter in the landing URL's query, after one round of
application/x-www-form-urlencodeddecoding (so+is a space). It's used only when it matches^[A-Za-z0-9._~-]{1,512}$; otherwise it's ignored, never rewritten, and a later value of the same parameter isn't tried.Storing: for each click ID, the module sets
<cookie>=<t>.<id>; Max-Age=<maxAgeDays × 86400>; Expires=…; Path=/; [Domain=.<domain>;] SameSite=Lax; [Secure;] [HttpOnly], where<t>is the current time in whole Unix seconds and<id>the click ID unchanged. When the request already carries the cookie with a value of the form<digits>.<id>for the same<id>, it's not set again: the lifetime counts from the click and isn't refreshed by later visits. A different click ID for the same parameter replaces it. Cookies of parameters without a click ID in the URL are left alone.Output: cookies only, so the status is
empty. Click IDs MUST NOT appear ineids,ortb2,extor anywhere else in the payload or headers.Consent: click IDs are stored only when all of these hold; otherwise nothing is stored, and the module deletes each cookie of its configuration (enabled parameters, and parameters listed with
enabled: false) the request carries, withMax-Age=0and the configuredDomainandHttpOnly:storage.allowedis true (so not on opt-out,Sec-GPC: 1,coppa=1, a TC string that doesn't give the SharedID's consent, or GDPR applying without a TC string);- the US Privacy string, from the
us_privacyparameter, else theusprivacycookie (the IAB CCPA framework's first-party cookie), doesn't haveY(in either case) as its third character, an opt-out of sale; - when the request has a TC string, or GDPR applies, the TC string's publisher TC segment consents to Purposes 1 and 7.
Opt-out:
{basePath}/optoutdeletes each cookie of the module's configuration the browser sent, whether or notclickidis inSID_MODULES.Caching: every result has
noStore: true, so a/syncit runs on isCache-Control: no-store(see Modules on/sync). A browser caches a sync by its URL, whatever page requested it, so a cached sync would hide every landing page until it expired. WithSID_SYNC_MODULESleavingclickidout, syncs are cached as usual, and only/v1stores click IDs.Its
routesarev1andsync.