# Campaigns

> The five campaign types, who can join, and how budgets and limits work.

Source: https://docs.onari.xyz/docs/concepts/campaigns

Your team creates campaigns in the dashboard. As a developer you mostly need to know which events each one listens for and what your server will be asked to pay.

## Campaign types

| Type | A player wins when… | Listens for |
|---|---|---|
| **Challenge** | they do the event N times (optionally each worth at least an amount). With more than one win allowed, the count starts again after each win. | one event |
| **Streak** | they do the event every day, week or month (or every weekend) for N periods in a row. Missing a period starts the count again. | one event |
| **Leaderboard** | they're in the top N when it ends, by number of events or by total amount. Ties go to whoever got there first. | one event |
| **Referral** | a friend they invited does the event for the first time. Both of them win. | one event + `referred_by` |
| **Trivia** | they score enough in a quiz (or make the top N), played in the Rewards Hub. Timed on Onari's servers. | nothing: played in the Hub |

## Who can join

- **Everyone**, **new players** (first seen in the last 30 days), or **inactive players** (no events in the N days before the campaign started).
- **Hold-back group:** optionally keep a percentage of players out of the campaign to measure its effect. They don't see it and can't win.

A player's audience is decided the first time they touch the campaign and doesn't change after that.

## Limits that protect your budget

- **Budget:** a hard cap on the total value of rewards. Once a reward wouldn't fit, nobody else wins; you get `budget.threshold_reached` at 90% and `campaign.budget_reached` when it's used up.
- **Wins per player:** usually 1.
- **Schedule:** start and end dates in your time zone.

## Pausing and ending

Your team can pause, resume or end a running campaign. While paused, players keep their progress but nobody can win. Ending a leaderboard or "top N" trivia pays its winners straight away.
