Skip to content

AudienceOptions

The audience half of createContentClient: everything between “this visitor” and “the right content” that an implementer should never have to know about. It asks Content which audiences it uses, asks Audience which of them the visitor is in (once per session, using the visitor’s cookie and consent where they exist), keeps the signed answer in memory only, hands it to every read, and renews it before it expires or when something may have changed (a Forms submission, the tab becoming visible again after a pause, a response that says the token is stale). It never throws into a page: when Audience cannot answer, the visitor simply holds no audiences and onError hears about it.

apiKey: string

An Audience delivery key. A key with an allowed-origins or IP restriction is browser-safe; one with neither is a server key and must never reach a browser.


optional baseUrl?: string


optional consent?: AudienceConsentSignals | (() => AudienceConsentSignals | undefined)

The device’s raw consent signals (cmp, gpc, dnt, cmpString), when your site has them. Only Audience turns these into a decision.


optional context?: ContextBag | (() => ContextBag | Promise<ContextBag>)

What the page knows about this visit, sent to Audience only (never to Content), so a campaign tag can place the visitor in a “came from a campaign” audience without splitting Content’s cache. A flat object of strings, numbers, booleans and lists of those, or a function producing it each time the visitor’s audiences are asked for.


optional fetch?: {(input, init?): Promise<Response>; (input, init?): Promise<Response>; }

(input, init?): Promise<Response>

MDN Reference

URL | RequestInfo

RequestInit

Promise<Response>

(input, init?): Promise<Response>

MDN Reference

string | URL | Request

RequestInit

Promise<Response>


optional handoff?: boolean

Whether to act on a #ebitex-verify=<code> fragment in the page’s address: the code a verification page hands to the page it continues to, so the browser that followed an emailed link is verified too. On by default; false leaves the fragment alone.


optional onError?: (error) => void

Called when Audience or the audience list could not be read. The page still renders (the visitor holds no audiences); this is for your logs.

unknown

void


optional visitor?: string | (() => string | null | undefined) | null


optional visitors?: object

The visitors SDK instance (createVisitors(...)): its token is the device’s visitor token. Or pass the token yourself with visitor. In a browser with neither, the ebitex_visitor cookie is read.

readonly token: string | null