# Splits

Splits allow you to divide a line item's traffic into segments, each with its own targeting, CPM, and creatives. This is useful for A/B testing, geo-based pricing, or running different creatives for different audiences within the same campaign.

## How splits work

When a line item has splits defined, the system evaluates each split independently:

1. **Traffic allocation**: Each split has a `percentage` (0 to 1). A random number is drawn and compared. If the random value is below the percentage, the split is considered for delivery.
2. **Targeting**: The split's targeting criteria are evaluated (AND logic). All criteria must pass.
3. **Creative matching**: The split's creatives are matched against the impression (dimension matching for banners).
4. **Fallback**: If no split is eligible, the line item's own creatives are used as a fallback (subject to dimension matching).

## Split structure

| Field           | Type           | Description                                                      |
| --------------- | -------------- | ---------------------------------------------------------------- |
| `id`            | number         | Unique split identifier                                          |
| `name`          | string         | Split name                                                       |
| `percentage`    | number         | Traffic allocation ratio (0 to 1, where 0.5 = 50%)               |
| `cpm`           | number         | CPM override for this split (0 = use line item rate)             |
| `targeting`     | object         | Split-level targeting criteria                                   |
| `creatives`     | array          | Creatives specific to this split                                 |
| `goal`          | number \| null | Split-level delivery goal                                        |
| `goalType`      | string         | `impressions`, `clicks`, or `spend`                              |
| `pacingType`    | string         | `asap`, `even`, or `frontloaded`                                 |
| `deliveryRatio` | number         | Dynamic delivery ratio (0 to 1), calculated by the pacing system |

## Split targeting

Line items and splits share the **same `Targeting` shape**. See the full attribute reference in [Targeting](/campaign-delivery/targeting.md). Each attribute uses `{ excluded: boolean, value: [...] }` (or an array of `{ excluded, value: Record<string,string[]> }` for the data-targeting variants).

| Attribute              | Description                                                      |
| ---------------------- | ---------------------------------------------------------------- |
| `geography`            | Country, region, or city (mixed levels supported)                |
| `domain`               | Publisher domain (wildcard support)                              |
| `site`                 | Nexx360 site ID                                                  |
| `tagId`                | Nexx360 tag ID                                                   |
| `page`                 | Exact `site.page` URL                                            |
| `device`               | Device type                                                      |
| `os`                   | Operating system                                                 |
| `browser`              | Browser (substring match on UA)                                  |
| `browserLanguage`      | Device language (prefix matching)                                |
| `connection`           | Connection type                                                  |
| `keyword`              | Page keywords                                                    |
| `firstId`              | First-party ID from `user.ext.eids` (source `first-id.fr`)       |
| `dayandtime`           | Day of week + hour range (e.g. Monday 09:00–17:00)               |
| `viewabilityThreshold` | Minimum viewability percentage                                   |
| `impData`              | Per-impression data (`imp.ext.data`)                             |
| `siteAppData`          | Site or app data (`site.ext.data`, falls back to `app.ext.data`) |
| `userData`             | User data (`user.ext.data`)                                      |

### Day and time targeting example

Target weekdays during business hours:

```json
{
  "dayandtime": {
    "excluded": false,
    "value": [
      { "day": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"], "hours": { "start": "09:00", "end": "17:00" } }
    ]
  }
}
```

### Data targeting example

```json
{
  "userData": [
    { "excluded": false, "value": { "audience": ["premium"] } },
    { "excluded": true,  "value": { "category": ["adult"] } }
  ]
}
```

## Split CPM

When a split has `cpm > 0`, that CPM overrides the line item's base rate for creatives delivered through that split. The split CPM is used in bid selection and appears in the bid response.

## Delivery capping per split

Each split can be independently capped. See [Pacing and Capping](/campaign-delivery/pacing-and-capping.md) for details.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.nexx360.io/campaign-delivery/splits.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
