Chat SDK
Tracking and Attribution
Understand impression and click tracking with the Chat SDK
Tracking and Attribution
How tracking works
- Impression is auto-tracked when
getAd()orgetAdForContent()returns an ad. - Click must be tracked explicitly in UI handlers.
Server tracking
const ad = await ads.getAdForContent({
sessionId: 'page-42',
contentText: pageText
});
if (ad) {
await ads.trackClick(ad.adId, ad.publisherId, ad.requestId);
}
Vue / React tracking
const { trackClick } = useIdlenAd({ apiKey: 'idl_pk_...' });
Attach trackClick to your CTA click event.
Attribution checklist
- Keep stable
sessionIdfor the same page/session lifecycle. - Use one ad fetch per render cycle to avoid duplicate impressions.
- Always wire click handlers on rendered ad links/buttons.