Specify docs

A/B testing with ad unit IDs

Label each placement so you can compare how they perform.

If you have more than one placement in your app, such as a header banner, an inline card, or a sidebar slot, you'll want to know which ones are actually performing.

Every call to serve accepts an adUnitId, a string you define to label each distinct placement. Specify then tracks impressions and conversions separately per ad unit, so you can see in your dashboard:

  • Which placements convert best, and therefore contribute most to your revenue share tier
  • Which placements are dragging down your average, and might be better removed, redesigned, or moved
  • A/B test results: run two variants of the same placement under different ad unit IDs and compare real conversion data

How to use it

Pass a different adUnitId from each placement.

placements.js
import { specify } from './lib/specify';
import { ImageFormat } from '@specify-sh/publisher-sdk';

const header = await specify.serve(wallets, {
  imageFormat: ImageFormat.LONG_BANNER,
  adUnitId: 'header-banner'
});

const sidebar = await specify.serve(wallets, {
  imageFormat: ImageFormat.LANDSCAPE,
  adUnitId: 'sidebar-inline'
});

To A/B test one placement, serve the variants under different IDs and compare them in your dashboard.

ab-test.js
const adUnitId = userBucket === 'a' ? 'swap-card-v1' : 'swap-card-v2';

const ad = await specify.serve(wallets, {
  imageFormat: ImageFormat.LANDSCAPE,
  adUnitId
});

Pick any naming scheme that works for you. Common patterns:

  • By location: header-banner, sidebar-inline, footer-leaderboard
  • By variant: swap-card-v1, swap-card-v2
  • By page: dashboard-hero, portfolio-inline, settings-footer

The IDs are opaque to us. They're purely for your own analysis. Keep them consistent across deploys so your historical data stays comparable.

Why it's worth doing

Most publishers who A/B test discover that their placements perform very differently from what they expected. A placement that looks great in design review often underperforms a less prominent one that happens to hit users at a more receptive moment. The only way to know is to measure.

On this page