JavaScript Quickstart
Add Adkit to any website with a single script tag. No build step or framework required — works on plain HTML, static sites, and any CMS that allows custom code.
Prerequisites
Add the script tag
Paste this tag inside the <head> of every page where you want to show ads. The defer attribute ensures it loads without blocking your page.
Place a slot element
Add a <div> with data attributes wherever you want an ad to appear. The SDK discovers these elements automatically on page load.
| Attribute | Required | Description |
|---|---|---|
| data-adkit-site | Yes | Your Adkit site ID |
| data-adkit-slot | Yes | Unique placement name (e.g. sidebar, header-banner) |
| data-adkit-aspect-ratio | Yes | 16:9, 4:3, 1:1, 9:16, or banner |
| data-adkit-price | Yes | Daily price in cents — 2500 = $25/day |
Price is in cents
data-adkit-price="2500" = $25/day. The server validates and enforces the price — it cannot be manipulated client-side.Complete example
A working minimal page with one ad slot.
Verify it works
Open your page in a browser. You should see a slot such as the one below.
Common patterns
Multiple slots on one page
Each slot needs a unique data-adkit-slot value. The SDK discovers all of them in a single pass.
Programmatic refresh
If you render slots dynamically (e.g. after a fetch or client-side navigation), call window.__adkit.refresh() to re-scan the DOM.