https://adsrouter.ai/llms-full.txt — it contains every endpoint, auth header, JSON schema, Koah bridge snippet, and beacon rule in one self-contained file.
Cloaked First-Party Beacons & Clicks
For every S2S ad (direct, network, house, gravity,
thrad, velocity), AdsRouter wraps tracking URLs on https://api.adsrouter.ai:
impression_beacon_url(GET /v1/imp/:id): Fire once when the ad is genuinely viewable (at least 50% visible in the viewport). AdsRouter stampsviewed_at, incrementsar_stats_daily.impressions, and returns204 No Contentfor own ads or302 Foundto the upstream network's impression pixel for mediated ads.render_beacon_url(GET /v1/render/:id): Returned when an upstream network (such as Thrad) uses two-stage billing. Fire immediately when the ad mounts in the DOM.click_url(GET /v1/click/:id): Always usead.click_urlas the linkhref(never bypass it). AdsRouter stampsclicked_at, incrementsar_stats_daily.clicks, and 302-redirects to the destination or upstream click URL.
Viewability Beacon Snippet (Custom Renderers)
function trackAdViewability(cardEl, ad) {
if (ad.render_beacon_url) {
new Image().src = ad.render_beacon_url;
}
let fired = false;
const fireImpression = () => {
if (fired || !ad.impression_beacon_url) return;
fired = true;
if (navigator.sendBeacon) {
navigator.sendBeacon(ad.impression_beacon_url);
} else {
fetch(ad.impression_beacon_url, { mode: 'no-cors', keepalive: true });
}
};
if ('IntersectionObserver' in window) {
const io = new IntersectionObserver((entries) => {
if (entries.some((e) => e.isIntersecting && e.intersectionRatio >= 0.5)) {
fireImpression();
io.disconnect();
}
}, { threshold: 0.5 });
io.observe(cardEl);
} else {
fireImpression();
}
}
Tiered Identity Resolution
Frequency caps need a stable per-user key without forcing cookies or PII. AdsRouter resolves identity_key in strict priority order:
| Tier | identity_kind | Source Field | Notes |
|---|---|---|---|
| 1 (Best) | maid | user.maid | Apple IDFA or Google GAID (only when end user consented). |
| 2 | pub_user_id | user.pub_user_id | Opaque publisher-scoped user ID from your app's auth system. |
| 3 (Fallback) | ip_ua_hash | device.ip + device.ua + accept_language | One-way sha256(ip|ua|accept_lang). No raw IP stored in the identity key. |
Frequency Caps & In-Flight Reservations
You can set frequency caps at both the property level (default_freq_cap_hourly,
default_freq_cap_daily) and the campaign level (freq_cap_hourly,
freq_cap_daily, freq_cap_window_sec).
To prevent rapid concurrent chat turns from blowing past a cap before the browser fires the viewability beacon,
AdsRouter counts viewed impressions (viewed_at IS NOT NULL) plus any
in-flight reservations (reservation_expires_at > now(), default 10 minutes).
If an ad is served but never viewed, its reservation expires automatically after 10 minutes and frees the cap slot.