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.
KontextAds.createSession(_:)
Session configured from the given SessionOptions. Fires /init in the background.
SessionOptions
Your unique publisher token.
Stable identifier for the end user. Used for personalization, frequency capping, and rewarded ads.
Unique ID of the current conversation / chat thread.
Placement codes to request ads for. Defaults to
["inlineAd"] when nil or empty.AI character metadata for contextual targeting.
Publisher-defined cohort identifier (e.g. for A/B testing).
Privacy / consent signals. TCF (
gdpr / gdprConsent) is collected automatically if a TCF-compliant CMP is integrated — set manually only for COPPA, GPP, or US Privacy.End-user email for frequency-cap deduplication.
IDFA you collected yourself. Takes priority over the SDK’s automatic collection. Use with
requestTrackingAuthorization: false.IDFV you collected yourself. Falls back to
UIDevice.current.identifierForVendor when nil.Whether the SDK should auto-request ATT authorization. Defaults to
true.Callback invoked on every ad lifecycle event. Called on the main thread.
Session
Append a When
Message to the conversation. Synchronous. User messages trigger a debounced preload.trackOnly: true, the preload is sent for analytics but no ad is generated.Returns an
Ad for the given messageId. Idempotent — repeated calls with the same messageId + placement code return the same Ad. Cache the result.Live-update preload-scoped fields. See Guides → Live-updating session options.
Tear down the session: cancel preloads, destroy ads, release web views. Idempotent.
Combine publisher delivering the same events as
onEvent. Useful for SwiftUI / Combine pipelines.Read-only snapshot of messages tracked by the session.
Server-assigned session ID.
nil until the first successful preload.true if the server has permanently disabled the session via the /init response (e.g. geo-restriction). Subsequent preloads are skipped.true after destroy() is called.MutablePublisherOptions
Subset of SessionOptions accepted by session.updateOptions(_:). Every field is optional — non-nil overwrites, nil leaves unchanged.
Message
Unique message ID.
.user or .assistant.Message text.
Defaults to
Date().AdOptions
Placement code. Defaults to
"inlineAd".UI theme hint forwarded to the ad iframe (e.g.
"dark").AddMessageOptions
When
true, the preload is still sent (for analytics) but no ad is generated for this message. Defaults to false.AdEvent
AdEvent is an enum with one typed payload per case. Every case has a stable string identifier accessible via event.name.
.filled(FilledData) — wire name ad.filled
An ad was returned and linked to the placement.
.noFill(NoFillData) — wire name ad.no-fill
No ad was returned for the placement (server skipped).
.adHeight(AdHeightData) — wire name ad.height
The ad iframe reported a new height. Use to size the surrounding container (especially in UIKit UITableView / UICollectionView cells).