Skip to main content
Full demand eligibility. This SDK runs in a real browser. All four demand tiers serve, and impression, engagement, and click tracking are automatic.

Install

Add the script tag before the closing body tag:
<script src="https://sdk.adgentek.ai/v1/adgentek.js?token=YOUR_PUBLISHER_TOKEN"></script>

Configure

Set global configuration before the script tag loads. All fields are optional:
<script>
window.adgentekConfig = {
  userId: 'optional-stable-id',
  theme: {
    colorScheme: 'auto',
    accentColor: '#1B6EF8',
    maxWidth: '640px'
  }
};
</script>

Register a placement

Call after each AI response with the conversational context for the turn:
adgentek.placement({
  query: userMessage,       // required: the user's message
  response: aiResponse,     // required: your AI's response
  target: '#ad-slot',       // optional: CSS selector or element; omit for auto-discovery
  turnId: 'turn-123'        // optional: pairs events across an SPA turn
});
The SDK decides whether to serve based on intent. Most turns serve nothing; that is by design.

Verify

  1. DevTools, Network tab: confirm the serve request and its response.
  2. Trigger a commercial-intent turn and confirm the ad renders.
  3. Confirm the impression pixel request fires from the page on render.

Reference

FieldTypeRequiredDescription
querystringYesThe user’s message for the turn
responsestringYesYour AI’s response for the turn
targetstring or ElementNoWhere to render; auto-discovery when omitted
turnIdstringNoStable ID pairing events across a turn