Docs
Everything you need to show AdPinata ad spots on your site. Most people are done after the quick start.
Quick start
1. Create a site and an ad spot in your dashboard. 2. Add the script once, anywhere on the page (just before </body> is ideal):
<script src="https://adpinata.com/embed.js" async></script>3. Put a placeholder where each ad spot should appear. Your dashboard shows the exact code for each spot.
<div data-adpinata-slot="slot_xxxxxxxxxxxxxxxx"></div>That's it. When a sponsor's booking is live, their ad appears. When the spot is free, an “Advertise here” box links to your booking page.
Options
data-adpinata-theme="light" | "dark" | "auto": colors for the ad.auto(default) follows the visitor's system setting.- Ads take the full width of their container. Banners never grow beyond their native width, so wrap them if you want them centered.
- Ads render inside a shadow DOM: your CSS can't break them and theirs can't touch your page.
Single-page apps
The script scans the page once when it loads. After client-side navigation, ask it to look for new placeholders:
window.AdPinata?.refresh();In React, call it in an effect in the component that renders the placeholder.
JSON API
Prefer rendering ads yourself, on the server or in a static build? Fetch them directly. The endpoint is public, CORS-enabled and cached for 30 seconds.
GET https://adpinata.com/api/serve?slots=slot_aaa,slot_bbb{
"slots": {
"slot_aaa": {
"kind": "card",
"ads": [
{
"id": "bk_…",
"title": "Tarn & Tide",
"body": "Waxed cotton raincoats, made in Portugal…",
"imageUrl": "https://adpinata.com/u/img_….webp",
"ctaLabel": "Shop raincoats",
"clickUrl": "https://adpinata.com/c/bk_…"
}
],
"placeholder": { "title": "Advertise here", "subtitle": "From $160 / week", "url": "https://adpinata.com/your-site?slot=slot_aaa" }
}
}
}Always link to clickUrl (it counts the click, then redirects). To count an impression, request the pixel when the ad is shown:
<img src="https://adpinata.com/api/i?b=bk_…" width="1" height="1" alt="" />Newsletters
Newsletter ad spots aren't embedded. When a sponsor books, the booking page in your dashboard shows their copy and a tracked link. Paste both into your issue. Clicks are counted any time after the start date, because people open old issues.
How tracking works
- An impression counts when at least half of the ad is visible for one second, once per page view.
- Clicks go through a redirect that counts them, adds UTM tags (you can turn this off) and forwards the visitor.
- Bots, crawlers and repeated hits from the same visitor are filtered out. No cookies are set on your visitors.