Documentation Index
Fetch the complete documentation index at: https://docs.kontext.so/llms.txt
Use this file to discover all available pages before exploring further.
Handling no-fill
Subscribe toad.no-fill to know when no ad was returned (geo-restriction, frequency cap, server-side skip). The skipCode payload tells you why.
ad.filled / ad.no-fill / ad.error per response, so you can rely on hearing back on every user message.
Pass every message, suppress ads with trackOnly
Always feed every message into the session, even when you don’t want an ad to appear (e.g. user is on a free trial, in a no-ads region, or you’ve decided to show ads only every Nth message). Skipping addMessage calls breaks the conversation context the server relies on for targeting. See Pacing for the full pattern.
Use { trackOnly: true } to send the preload for analytics without generating an ad:
trackOnly: true, the preload still fires (server keeps full analytics) but no ad.filled event will arrive for that message and session.createAd(...) won’t resolve to an ad.
Live-updating consent mid-session
When the user updates their consent in your CMP, pass the new TCF string toupdateOptions:
Switching character
The activecharacter cannot be live-updated — the accumulated message history belongs to the original persona, so swapping mid-session would leave messages targeted at the wrong character.
To switch character, destroy the current session and create a new one:
publisherToken, userId, conversationId, and enabledPlacementCodes — recreate the session whenever any of those change.
Loading older messages (conversation restore)
When restoring a conversation from your backend, calladdMessage(...) once per historical message in order. Preloads are debounced (~10 ms), so rapid sequential calls coalesce into a single preload for the most recent user message — you won’t fire one preload per restored message.