Rendering native ad formats
Three ways to render a matched ad — raw API, a script embed, or the React SDK — plus what's actually in the response.
Three integration paths
- Call /api/v1/serve yourself and render the JSON with your own markup — full control, the path the rest of this article assumes
- Drop in the publisher embed script — no API calls required on your end; it auto-detects page category/intent from your page's meta tags
- Use the @adscod/react SDK — an <AdscodAd apiKey="..." placement="..." /> component that wraps the embed script for React apps
What's in the response
Each matched ad includes a headline, body text, an image URL, a CTA button label, and a click-tracking URL — plus brand identity fields (brand name, logo, a verified-advertiser badge) meant specifically for showing who's actually sponsoring the ad, optional price/compare-at price for offer-style creative, a human-readable match reason, and an optional product carousel for shopping-feed campaigns. If you're integrating via the raw API, you render all of this with your own markup — no iframe or third-party script. That's not true of the embed-script or React SDK paths, which do inject a script tag by design.
City guides
10 Lagos spots worth the hype
Every list swears by the same four places. We spent a month eating our way across the mainland instead — here's what actually earned the queue.
Summer sale — 30% off everything
Free delivery in Lagos. Ends Sunday at midnight.
$120.00 $160.00
Shop nowStart on Victoria Island, but don't stop there — the best plate we ate all month cost less than the parking.
Native rendering principles
- Match the ad's typography and spacing to your surrounding content so it reads as native, not bolted-on
- Show the brand name/logo when present — it's there so viewers know who's actually advertising, not just that it's sponsored
- Label sponsored content clearly (e.g. "Sponsored" or "Ad") — this is required and keeps trust with your audience
- Use the exact click-tracking URL provided — don't construct your own link to the destination
Common placements
- In-feed cards between content items
- Sidebar or end-of-article native units
- In-app native cards between content cards in mobile apps
Handling no-fill
The engine automatically backfills an empty slot with a house ad when no paid campaign matches, so a genuinely empty response is rare — but when it does happen (or your domain is blocked), don't render an empty slot: collapse it or show fallback content so your layout doesn't break.