Installation
Add Adkit to any website with a single script tag. No npm, no build step, no framework required.
Prerequisites
Add the script tag
Add the Adkit script to the <head> of every page where you want ads. The defer attribute loads the script without blocking page render.
The script is served from Adkit's global CDN (~18KB minified / ~5.8KB gzipped). Average load time is under 50ms.
Place a slot element
Add a <div> with data attributes wherever you want an ad. The SDK discovers and initializes all slot elements automatically after the page loads.
Price is in cents
data-adkit-price="2500" displays as $25/day. The server validates and enforces the final price — it cannot be manipulated client-side.Verify it works
Open your page in a browser. You should see a preview like the one below.
If the slot doesn't appear, open the browser console — all errors are prefixed with [Adkit].
Complete page example
Initialization behavior
The SDK waits for the load event, then yields with setTimeout(0) to allow frameworks to hydrate before it scans the DOM. This means slots added by a framework during hydration are picked up automatically.
A MutationObserver watches document.body for dynamically added slot elements. Slots inserted into the DOM after initial load are initialized within 100ms automatically — no manual call needed in most cases.
For explicit control (e.g., after a client-side navigation), call window.__adkit.refresh().
Content Security Policy
If your site uses a CSP, add the following directives: