> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apostra.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Campaign test design

> Agree how a campaign will be tested, and let saving the design write its exclusions into the campaign.

> [!NOTE]
>
> Campaign test design is in beta. Your account needs the buyer beta to set one;
> without it `save_campaign` refuses `testDesign`, `preview` and
> `confirmationToken` as not available, and the campaign read leaves `testDesign`
> out and lists `testability` under `unavailableIncludes`. A design already saved
> keeps applying to the campaign's buys.

A test design is the agreed way to find out whether a campaign caused its
outcome. It is an optional field on the campaign, `testDesign`. `save_campaign`
writes it and the campaign read returns it. `null` means no design is agreed.

Saving a design does more than record it. It writes into the campaign the
targeting and audiences the test needs, so every brief, proposal and buy the
campaign makes afterwards inherits them. Sellers see ordinary AdCP targeting;
no test instruction goes on the wire.

## The three designs

Every design has an `outcome`: the AdCP event entry
(`event_source_id`, `event_type`) that names the sales feed the test is read
from. As on an optimization goal's event source, `custom_event_name` is
required when `event_type` is `custom` and refused otherwise. The event source
must be live on the advertiser and report that event type.

| `kind` | What it compares | What saving it writes |
| - | - | - |
| `audience_holdout` | People who could see the campaign with an audience held out of it. | The holdout audience (`holdoutAudienceId`) is added to the campaign's suppressed audiences (`audienceConfig.suppressAudienceIds`). |
| `geo_split` | Treatment areas that receive the campaign with control areas that do not. | The control areas go into the campaign's `geo_*_exclude` targeting. The treatment areas become the campaign's geo targeting. |
| `pre_post` | The flight with a baseline of equal length before it. | Nothing. |

A `geo_split` has a `treatment` arm and a `control` arm. Each carries one AdCP
geo field of area codes (`geo_countries`, `geo_regions`, `geo_metros`,
`geo_postal_areas` or `geo_places`), the same field on both, so the arms are
compared at one geo level. Save refuses a design whose arms are empty, share an
area, or use different levels.

```json theme={null}
{
  "campaignId": "camp_123",
  "testDesign": {
    "kind": "geo_split",
    "outcome": { "event_source_id": "web_sales", "event_type": "purchase" },
    "treatment": {
      "geo_metros": [{ "system": "nielsen_dma", "values": ["501", "803"] }]
    },
    "control": {
      "geo_metros": [{ "system": "nielsen_dma", "values": ["602", "623"] }]
    }
  }
}
```

## What a geo split does to the campaign's targeting

* The control areas are written as excludes at that level, even areas the
  campaign never targeted, so a later widening of the campaign cannot reach
  them.
* The treatment areas replace the campaign's geo targeting, at every level,
  so no area outside the two arms can receive the campaign and join the
  treatment arm by default.
* The design records the geo targeting it replaced. Clearing the design puts it
  back. Exclusions the campaign already had stay.

A treatment area must sit outside every country the campaign excludes. The
country is read from the area: a region code, a postal or place entry's
`country`, or a metro system tied to one country (`nielsen_dma`, `uk_itl1`,
`uk_itl2`). Save refuses a treatment area whose country is excluded, or whose
country cannot be read, while the campaign excludes any country.

The preview shows the narrowing, before and after.

## Preview, then confirm

A design changes what the campaign can deliver, so a person confirms it.
`save_campaign` takes `testDesign` on its own, with the same two steps as a
brand change on an advertiser:

1. Send `testDesign` with `preview: true`. Nothing is saved. The result lists
   the exact change to the campaign's targeting and suppressed audiences, how
   many proposals were quoted before the design (they do not carry it), and a
   `confirmationToken`.
2. After the person confirms, send the same `testDesign` with the
   `confirmationToken`. The token is bound to that exact change and to the
   campaign's revision. If the campaign or the design changed since the
   preview, the save is refused as stale and nothing is written. Preview again.

Without a token, a design change returns `CONFLICT` and saves nothing. Setting,
changing and clearing a design all use these two steps. Send `testDesign` alone:
it cannot be combined with other campaign fields in the same call. It is set on
an existing campaign, after its goals and before its briefs and buys.

## The design owns what it wrote

The design records the exact values it added. While it is set:

* A save that removes one of them is refused, and the refusal names the design.
  That includes clearing the campaign's targeting or taking the holdout out of
  the suppressed audiences.
* Under a `geo_split`, a save that adds geo targeting at the design's level
  outside the treatment and control areas is refused.
* To change what the design owns, change or clear the design.

Clearing the design removes only the values it added. A value the campaign
already had, such as a control area the buyer had already excluded, is kept.

## The design locks when a buy leaves draft

Once any buy in the campaign has left draft, a change or clear of the design is
refused, and the refusal says why. Buys already placed carry the design's
exclusions, so changing it mid-flight would break the comparison.

## Sellers

A seller that cannot apply an exclusion cannot take part in the test. A buy
that targets what its product does not declare is refused, and the refusal
names the design when the field came from it.

## What a campaign can be tested with

Ask the campaign read for `include: ["testability"]` before you save a design.
The API decides what the campaign can run, so an agent does not have to work it
out.

```json theme={null}
{
  "testable": true,
  "blocker": null,
  "reason": "purchase on web_sales events cover the baseline 2026-12-06 to 2026-12-19 with no feed gap over 7 days. Counts stay revisable until 2027-01-10, when the flight is readable.",
  "offers": [
    { "kind": "audience_holdout", "ready": false, "blocker": "audience_narrowing_unavailable", "why": "..." },
    { "kind": "pre_post", "ready": true, "blocker": null, "why": "..." }
  ],
  "window": {
    "baselineStart": "2026-12-06",
    "baselineEnd": "2026-12-19",
    "readableAt": "2027-01-10",
    "purchaseCycleDays": 7,
    "reportingLagDays": 1,
    "seasonality": { "period": "holiday_peak", "overlaps": ["baseline", "flight"] }
  },
  "sellersLeftOut": [],
  "sellersOmitted": 0
}
```

* `testable` is true when some offer is `ready`; `blocker` is then `null` and
  `reason` is that offer's `why`. When nothing is ready, `blocker` and `reason`
  name what stops the saved design, or, with no design saved, what stops
  before-and-after, because it writes nothing to the campaign.
* `offers` run best evidence first: `audience_holdout`, then `geo_split`, then
  `pre_post`. A holdout compares like with like in the same weeks. Before-and-after
  cannot separate the campaign from season, price or other media.
* The read is part of the buyer beta and costs one read of the advertiser's
  sales history, so ask for it only when you need it. A plain campaign read never
  does it.

### The offers and their blockers

An offer that is `ready: false` carries one `blocker`:

| `blocker` | Offer | Meaning |
| - | - | - |
| `design_not_saved` | `geo_split` | Offered, but it is not the saved design, so its exclusion is not in the campaign. Save it to use it. |
| `audience_narrowing_unavailable` | `audience_holdout` | A seller cannot yet be told to leave an audience out. A holdout is not ready until audience narrowing is available. |
| `no_seller_can_run_it` | `geo_split` | No seller the campaign can reach declares geo targeting with exclusion at the design's level. |
| `level_not_in_proposals` | `geo_split` | The design's geo level is places, which a proposal does not carry to a seller. |
| `proposals_not_scoped` | `geo_split` | Seller quotes don't yet reflect the control areas, so results would compare unlike prices. See below. |
| `proposals_predate_design` | `geo_split` | Proposals quoted before the design was saved do not carry it. The read says how many. Request proposals again. |
| `flight_not_set` | `pre_post` | Before-and-after compares the flight with a baseline before it, so the campaign needs a flight. |
| `outcome_not_named` | `pre_post` | No goal on the campaign names a sales event and no design is saved. |
| `baseline_history_short` | `pre_post` | The feed has not stored this outcome back to the start of the baseline. The `why` names the earliest event and the date the baseline needs. |
| `baseline_feed_gap` | `pre_post` | The feed sent no event of any type for more than 7 days inside the baseline. The `why` names the dates. |
| `baseline_past_retention` | `pre_post` | The whole baseline would no longer be stored when the flight is readable, or it has already aged out. |

A `geo_split` is offered only when the campaign's geo targeting spans at least
two areas at one level (country, region, metro or postal area) and at least one
seller the campaign can reach declares inclusion and exclusion at that level. A
seller counts only when it has said so; one we cannot judge does not.

### Seller quotes and the test's exclusions

Proposals are quoted today without a geo split's control areas, so their
forecasts and prices describe the wider audience. Until proposal requests carry
the campaign's targeting, a saved `geo_split` reports `proposals_not_scoped`.
Buys still inherit the design when they launch. Discovery (`get_products`)
already scopes a forecast to every exclusion and leaves a forecast off a
seller that cannot be sent one.

### Before-and-after windows

`window` is present once the campaign has a flight and an outcome. Days are UTC
days, both ends included.

* **Baseline.** As long as the flight, ending the day before it starts.
* **Purchase cycle.** The longest click attribution window on the goals that
  name the outcome. Where no goal sets one, **28 days** applies. Ask the buyer
  for the real cycle.
* **Reporting lag.** The median delay between an event happening and the feed
  receiving it, over the last 30 days, per outcome. It is `null` until the
  outcome has an event in that period, and counts as 0 days in `readableAt`.
* **`readableAt`.** The flight's last day plus the purchase cycle plus the
  reporting lag. Counts for the baseline and the flight can still change until
  then, because late and back-dated events land in old days.
* **History is per outcome.** The event source, event type and, for a custom
  event, its name together. Months of other events on the same source are not
  history for a new event type. A source that has never stored an event has no
  history at all.
* **Feed gaps.** A run of days with no event of any type from the source,
  judged only over days that have ended and are still stored. More than **7
  days** inside the baseline is `baseline_feed_gap`.
* **Retention.** The feed keeps events **180 days** by `event_time`. The whole
  baseline must still be stored when the flight is readable, so twice the
  flight length plus the purchase cycle plus the reporting lag must be at most
  180 days. With the 28-day cycle and no lag, a flight of up to 76 days fits. A
  longer flight can run a holdout or a geo split.
* **Seasonality.** A short list of named high seasons per country. A season
  that crosses the baseline or the flight is reported with the window it
  crosses. A country with no entry has `seasonality: null`.

| Season | Countries | Dates |
| - | - | - |
| `holiday_peak` | US, CA, GB, IE, DE, FR, NL, AU | 15 November to 31 December |
| `back_to_school` | US, CA | 1 August to 15 September |

### Sellers left out

While a `geo_split` is saved, `sellersLeftOut` names each seller that declares
it cannot apply the design's geo fields, with its `sellerAccountId`,
`sellerName` and `needs`, up to 25; `sellersOmitted` counts the rest. A seller
is listed only when every source it sells through declares it cannot. Today the
list is information: a proposal round still asks those sellers, and a buy that
targets what its product does not declare is refused and names the design.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.