## Overview

**Priorities** determine what sets of ads have precedence over others. For instance, you can set rules so that House Ads (internal promotions) only appear if there's no advertiser to fill the slot.

Priorities work like a waterfall: the Kevel engine will attempt to fill any impressions that aren't captured by the highest priority with the next highest priority, and so on.

They are set at the [Channels](https://dev.kevel.co/v1.0/docs/channels) level. For most clients, this will be the default **All Sites Channel**.

> 📘
>
> Priorities are designated by a number: **1** is the highest priority while **100** is the lowest priority.

## Default Priorities

Kevel automatically creates three common Priorities for you. You can add up to 97 additional priorities in a given Channel (100 total).

| Name         | Weight | Selection Method |
|--------------|--------|------------------|
| **Sponsorship** | 1      | Lottery          |
| **Premium**     | 5      | Lottery          |
| **House**       | 20     | Lottery          |

## Priority Fields

Below are the fields related to a Priority you'll find in the UI and/or API.

| Property |                                       |                                  |
|----------|---------------------------------------|----------------------------------|
| **Priority Name** | Friendly name for the priority | `name`<br>(string)               |
| **Channel**       | The Channel's ID, needed only for the API | `ChannelId`<br>(integer)        |
| **Weight**        | Determines if ads are prioritized over ads in other priorities (a lower number is prioritized over higher numbers, with 100 last). You can set this to any value not being used | `Weight`<br>(integer)           |
| **Selection Method** | Choose which selector the ad engines use to select an ad from this priority. Defaults to Lottery (`0` in API). | `SelectionAlgorithm`<br>(integer) |
| **Enable Second Pricing**<br>(optional) | Auctions only.                     | `IsSecondPricing`<br>(boolean)  |
| **Floor Price**<br>(required)   | Auctions only. It's the minimum bid needed to win the slot. Set to `0` if this doesn't matter to you. | `FloorPrice`<br>(float)        |
| **Remainder Percentage**<br>(required) | Auctions only. Refers to the percentage of impressions that ads with lower eCPMs will receive, which is used to give poor-performing ads a "second-chance". Set to `0` if this doesn't matter to you. | `RemainderPercentage`<br>(integer) |

> ❗️
>
> ### SelectionAlgorithm
>
> This may only be set on creation, and this field cannot be updated. Values include:
> 
> `0 = Lottery`
> `1 = Auction`

> 📘
>
> The **Remainder Percentage** is used to artificially bump up ads that have lower eCPMs. For instance, if you put `5`, that means 5% of impressions won't be optimized for max revenue, but will instead be used to give ads that once performed poorly a 2nd chance to get data.

## Adding Priority - UI

To add a priority, follow the steps below.

1. **Inventory** --\> **Channels**
2. Click on **Priorities**, which is to the far right
3. Click **Add a New Priority To This Channel** in top left
4. Fill in the required fields. If creating an Auction priority, there's more info [here](https://dev.kevel.co/docs/auction-general-settings).
5. Save

> 🚧
>
> The Weight cannot be already used by another Priority. Also, once you save, the Selection Method cannot be updated.

## Finding a Priority with UI

1. Go to **Inventory** --\> **Channels**
2. Click on **Priorities** to the right of your Channel (you'll probably be using "All Sites"). You'll find the ID to the right of the name.

## Creating a Priority with the API

Use the [Create Priority](https://dev.kevel.co/v1.0/reference/priority#create-priorities) endpoint. The call will look like:

```json
priority={
  "Name":"High Priority",
  "ChannelId":1234,
  "Weight":2,
  "SelectionAlgorithm": 1
}
```
