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
- DevTools, Network tab: confirm the serve request and its response.
- Trigger a commercial-intent turn and confirm the ad renders.
- Confirm the impression pixel request fires from the page on render.
Reference
AdgentekAds.init(options) — global configurationhttps://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:
Methods
Markup
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
UsegetAd() 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:
Clicks are tracked by navigation, not by a method call. Make your clickable element an anchor
whose The redirect through
href is ad.click_url:click_url is what records the click. A <button> with a JavaScript handler
records nothing.
