Impression Pixel

GET /api/ad/pixel — Record an ad impression.

How It Works

The serve endpoint returns an impression_url in the ad response. When the ad is actually displayed to a user, you load this URL to record the impression. The pixel returns a 1x1 transparent GIF.

Impressions are what advertisers pay for, so it is important to only fire the pixel when the ad is genuinely visible to the user.

How to Fire It

Use an image tag or a fetch call:

<!-- Image tag (simplest) -->
<img src="{impression_url}" width="1" height="1" alt="" />
// Fetch (if you prefer JS)
fetch(impression_url);

Deduplication

The pixel deduplicates impressions by IP address, placement, and campaign. If the same combination is seen within a 1-hour window, the duplicate is silently ignored — the pixel still returns the GIF, but no impression is recorded and no budget is spent.

Server-Side Served Ads

When you serve ads from your backend using the ip parameter, the serve endpoint bakes that IP into the impression_url. This ensures deduplication works correctly even when the pixel is later loaded from the client.

Caching

Do not cache the pixel URL or reuse it across page loads. Fire it fresh each time the ad is displayed. The pixel response is served with Cache-Control: no-store, no-cache, must-revalidate.