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:

Add an Ad Placement

The SDK renders into an element it finds by id. It does not create one, and it does not auto-discover slots. Place this exactly where the ad should appear (e.g. after the AI response)

Request an Ad

Call after each AI response with the conversational context for the turn:

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

AdgentekAds.init(options) — global configuration
https://api.adgentek.ai/ad-server/v1 is an alias for the default base URL. Both reach the same ad server and behave identically, so you do not need to set baseUrl at all. For new integrations we recommend /ad-server/v1, which matches the click_url and impression_url values the API returns:
AdgentekAds.showAd(messages, options) / requestAd(…) / getAd(…) Methods Markup
Note: requestAd/showAd return a Promise; getAd is the only path where the container div is optional.

The ad object

Every method that resolves to an ad gives you the server’s response object unchanged — no fields are stripped or renamed. The ones you are most likely to need: bid_price is always present and is the post-auction clearing price — what the winning bid cleared at, and therefore what you will be credited for. It is not a raw demand-side bid.
Reconcile against cp, not bid_price. bid_price is rounded to 2 decimal places. The cp query parameter on impression_url and click_url carries the same price at full precision, so use bid_price for the auction decision and cp for figures that have to tie out.

Running your own auction

Use getAd() when you want to compare our price against other demand before deciding to render. It returns the ad without rendering anything, so you can read bid_price first:
getAd() fires no tracking. You must fire it yourself, or the impression is never recorded and you are not paid for it.showAd() renders the ad and fires its pixels for you. getAd() does neither — that is the point of it, but it means the tracking obligation moves to you. Call fireDeferredTrackers(ad) once the ad is actually on screen.This fails silently: the ad renders correctly, the user sees it, and no impression appears in your reporting. If your dashboard shows requests but few or no impressions, this is the first thing to check.
Clicks are tracked by navigation, not by a method call. Make your clickable element an anchor whose href is ad.click_url:
The redirect through click_url is what records the click. A <button> with a JavaScript handler records nothing.