For publishers approved to integrate Carbon directly. Fetch the ad as JSON, render it in your own markup, and follow the rules below so every impression counts.
Must breaks tracking or the advertiser’s approval if skippedYours your design call
ignore=yes on every request outside production.You need a zone key, which we send when your site is approved for a direct integration. There is no script to load: you request the ad as JSON and render it in your own markup.
Build against our two demo zones first. Each always returns the same format, so you can get each renderer right against a fixed ad. To test the rest of your dispatch, an empty response and an unknown shape, save a real response and edit it.
| Zone | Returns |
|---|---|
CWYIC2QJ | Carbon Cover, every request |
CVAIKKQM | Carbon Classic, every request |
With ignore=yes, ads still load but no impression is counted.
forwardedip and useragent.Without the visitor’s details, every impression comes from your server’s address and is filtered out as invalid.
| Parameter | When | What to send |
|---|---|---|
forwardedip | Server-side | The visitor’s IPv4 address, from X-Forwarded-For. Not your server’s. |
useragent | Server-side | The visitor’s user agent, URL-encoded. |
placement | Recommended | A fixed name for each spot on your site, such as sidebar, so results can be read per spot. |
ignore | Not in production | yes serves an ad without counting the impression. |
# from the browser
GET https://srv.buysellads.com/ads/{zonekey}.json?placement=sidebar
# from your server
curl -G https://srv.buysellads.com/ads/{zonekey}.json \
-d forwardedip=198.51.100.123 \
-d useragent=Mozilla%2F5.0... \
-d placement=sidebarThe impression is counted when the request succeeds. There is nothing to fire when the ad renders, and the statimp field in the response isn’t used.
A cached response’s tracking links belong to the view it was served for. In a single-page app, check that a remount, a route change or a development double-render doesn’t send a second request.
statlink, show your own content, never another network’s ad.A response without statlink means no ad was served this time. A filled response that isn’t Cover is a Classic ad, which is a paid ad, not an empty slot.
const COVER = [
'backgroundColor',
'callToAction',
'company',
'companyTagline',
'logo',
'largeImage'
];
const ad = (await res.json()).ads?.[0];
if (!ad?.statlink) return showOwnContent();
if (COVER.every(k => ad[k])) return renderCover(ad);
if (classicImage(ad)) return renderClassic(ad);
return showOwnContent(); // a shape we don't know: log itbackgroundColor.Advertisers approve their image, logo and color together, against that one treatment. Keep it and the rest of the design is yours.
| Field | Supplied as | How to show it |
|---|---|---|
largeImage | 500×500 | At 180×180px, up to 250×250px. Also the blurred background. |
logo | 250×100 | At 125×50px. Never cropped or recolored. |
companyTagline | Up to 45 characters | Next to the logo, from the start, in white. |
description | Up to 100 characters | Revealed on hover, in white. Reachable on touch too. |
callToAction | Up to 20 characters | A white button with near-black text, visible from the start. |
backgroundColor | Hex | Washed over the blurred largeImage. 80% is a good start. |
company | Up to 30 characters | The image’s alt text. |
When the description appears, reserve its space so the button doesn’t move. Below a 360px-wide container, stack the unit in one column and show the description all the time; the sample handles the description. Measure the container, not the screen, since the unit may sit in a sidebar.
.cover-text { display: flex; flex-direction: column; height: 100px; }
.cover-description {
flex-grow: 1; overflow: hidden; opacity: 0;
transition: opacity .1s ease-out;
}
.cover:is(:hover, :focus-visible) .cover-description {
opacity: 1; transition: opacity .5s ease-in .25s;
}
/* no hover to reveal it: a touch screen, or a stacked unit */
@media (hover: none) { .cover-description { opacity: 1; } }
.cover-slot { container-type: inline-size; }
@container (width < 360px) { .cover-description { opacity: 1; } }
/* the image, under a blurred wash of its color */
.cover {
position: relative; isolation: isolate; color: #fff;
background: var(--art) center / cover;
}
.cover::before {
content: ""; position: absolute; inset: 0; z-index: -1;
background: color-mix(in srgb, var(--bg) 80%, transparent);
backdrop-filter: blur(8px);
}Classic carries one image and a description, nothing else: no tagline, no button. Reusing Cover’s hidden description renders a Classic ad with no words that still looks like it worked.
| Image, in this order | Supplied as | How to show it |
|---|---|---|
largeImage | 500×500 | At 100×100px. |
smallImage | 260×200 | From 130×100px up to 260×200px. Never cropped. |
logo on backgroundColor | 250×100 | 100px wide, on that color. |
Check all three: a renderer that only knows smallImage drops paid ads when the mix changes. Advertisers are asked for 100 characters, but a few run longer, so design for the long end.
const classicImage = ad =>
ad.largeImage ? { src: ad.largeImage, size: [100, 100] }
: ad.smallImage ? { src: ad.smallImage, size: [130, 100] }
: ad.logo && ad.backgroundColor
? { src: ad.logo, width: 100, ground: ad.backgroundColor }
: null;rel="sponsored noopener".The link goes to statlink, and “ads via Carbon” to ad_via_link. Treat every text field as untrusted input: escape it, or set it with textContent. A color or URL that goes into CSS can’t be escaped, so check its shape and set it from script.
<div class="cover-slot">
<a class="cover" href="{statlink}" target="_blank"
rel="sponsored noopener">
<img class="cover-image" src="{largeImage}" alt="{company}">
<div class="cover-logo">
<img src="{logo}" alt="">
<p>{companyTagline}</p>
</div>
<div class="cover-text">
<p class="cover-description">{description}</p>
<span class="cover-cta">{callToAction}</span>
</div>
</a>
<a href="{ad_via_link}" target="_blank" rel="noopener">
ads via Carbon
</a>
</div>
<script>
// colors and URLs go into CSS, which escaping doesn't protect
const cover = slot.querySelector('.cover');
const hex = /^#[0-9a-f]{3,8}$/i.test(ad.backgroundColor)
? ad.backgroundColor : '#333';
cover.style.setProperty('--bg', hex);
cover.style.setProperty('--art', `url("${encodeURI(ad.largeImage)}")`);
</script>pixel URL as a hidden 1×1 image.statview once, after a full second in view.statlink, unchanged.Pixel. Without it, the advertiser’s own ad server sees no impressions from your site. It can hold several URLs separated by ||. Replace every [timestamp]in each, and load each as an image rather than with fetch. Whether a pixel comes depends on the ad, not the format.
Viewability. The second starts when 30% of an ad of 242,500px² or more is on screen, or 50% of a smaller one. If it scrolls away first, start again.
Click. statlink records the click and redirects to the advertiser.
function firePixels(pixel, mount) {
if (!pixel) return;
// 10-second steps, as carbon.js sends
const ts = Math.round(Date.now() / 1e4);
for (const url of pixel.split('||')) {
const img = new Image(1, 1);
img.alt = ''; img.hidden = true;
img.src = url.replaceAll('[timestamp]', ts);
mount.append(img);
}
}
function watchView(el, statview) {
let inView = false, counting = false, timer;
// a hidden tab keeps its intersection, so it stops the second too
const check = () => {
const now = inView && !document.hidden;
if (now === counting) return;
counting = now;
clearTimeout(timer);
if (now) timer = setTimeout(() => {
io.disconnect();
document.removeEventListener('visibilitychange', check);
fetch(statview, { mode: 'no-cors' });
}, 1000);
};
const io = new IntersectionObserver(([e]) => {
// measured here, once the ad has laid out
const { width, height } = e.boundingClientRect;
inView = e.intersectionRatio >= (width * height >= 242500 ? 0.3 : 0.5);
check();
}, { threshold: [0, 0.3, 0.5, 1] });
io.observe(el);
document.addEventListener('visibilitychange', check);
}| Area | Yours | Fixed by the format |
|---|---|---|
| Layout | Size, shape, spacing, breakpoints. | Every field shown; images never cropped. |
| Type | Which sans-serif, its size and weight. | Sans-serif, white on Cover; text never cut short. |
| Color | Blur, wash strength, corners, shadow. | Cover’s blurred wash of backgroundColor; images never recolored. |
| Interaction | How and when the description appears. | The description reachable on every device; the click goes through statlink. |
| Tracking | Nothing. | The pixel, viewability and click, as above. |
ignore=yes.statview waits a full second, and the click opens statlink in a new tab.When it’s ready, send us your staging address. We’ll serve to it and confirm that impressions, viewability and pixels arrive before anything goes live.
Updated