Specify docs

A/B testing with ad unit IDs

Label each placement so you can compare how they perform.

If you show ads on more than one page, such as a swap screen and a portfolio page, you'll want to know which placements actually perform.

Every call to serve accepts an adUnitId: a string you define to label each placement. Specify 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: real conversion data for each variant of a placement

How to use it

Give each page's slot its own adUnitId. Specify shows one ad per page, so each page has a single slot.

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

const ad = await specify.serve(wallets, {
  imageFormat: ImageFormat.LANDSCAPE,
  adUnitId: 'swap-card'
});
portfolio-page.js
import { ImageFormat } from '@specify-sh/publisher-sdk';
import { specify } from './lib/specify';

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

A/B testing a placement

Split your visitors into groups and show each group one variant of the slot, under its own adUnitId. Never show both variants on the same page.

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

const adUnitId = userBucket === 'a' ? 'swap-card-v1' : 'swap-card-v2';

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

Keep a visitor in the same group across visits, so each variant's numbers come from its own people.

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

  • By page: swap-card, portfolio-banner, settings-footer
  • By variant: swap-card-v1, swap-card-v2

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