This is the 5-minute integration walkthrough. Before you start, make sure you’ve completed Installation.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.
1. Wrap your app in <AdsProvider>
<AdsProvider> initializes a session that’s available to every component inside it via the useAds() hook. Place it high enough in your tree so it can contain all ad placements.
2. Feed messages to the SDK
The SDK preloads ads in response to new chat messages. CalladdMessage() from the useAds() hook whenever a user or assistant message is created.
3. Mount <InlineAd>
An ad slot is a designated area in your UI where an ad can be rendered. In most cases, it appears below an assistant message.
Place <InlineAd /> wherever the ad should appear and pass the messageId of the assistant message it’s associated with.
Observing events
Subscribe to ad lifecycle events via the<AdsProvider> onEvent prop. Every event has a stable name and a typed payload:
ad.filled, ad.viewed, ad.clicked, ad.render-*, video.*, reward.granted) also carries a top-level code field naming the matched placement, so publishers with multiple enabledPlacementCodes can disambiguate. Session-wide events (ad.no-fill, ad.error) omit it.
For SDK-internal diagnostics during integration, also pass an onDebugEvent callback — it receives (name, data?) for every internal step.