# Campaigns

A campaign is one ad (the creative, in up to three variants of each part), a destination, a budget and targeting. Live limits, such as text lengths, minimum and maximum budget and daily limit, and media sizes, change over time and are shown in the Mini App.

## What a campaign consists of

- **Name**: seen only by the advertiser, and always generated from the content, in the advertiser's language. It can't be set or changed.
- **Title**: the headline.
- **Description**: the body text.
- **Button text**: the call-to-action label, e.g. "Learn More", "Subscribe" or "Start Bot". Required. With auto-subscription on, it is replaced by a label set from the link; see Auto-subscription below.
- **Link**: where a tap leads. It must be an `https://` link, either a website or a Telegram link to a channel, group, bot or mini app.
- **Media**: the main image. Required.
- **Avatar**: a square image, shown as the ad's logo. Required. It can be replaced, never removed.
- **Crops**: an optional wide crop of each main media variant and an optional square crop of each avatar variant, as percentages of the image. The full image is kept; the placement versions are cut from the crop.
- **Budget** and an optional **daily budget limit**. See https://ad.api.imem.me/docs/billing.md | docs_billing.
- **Targeting**: automatic or manual. See https://ad.api.imem.me/docs/targeting.md | docs_targeting.
- **Conversion type**: which post-click action counts as a conversion for this campaign. See https://ad.api.imem.me/docs/conversions.md | docs_conversions.
- **Conversion tracking**: whether the destination URL carries a click id so actions can be attributed. See https://ad.api.imem.me/docs/conversions.md | docs_conversions.
- **Auto-subscription**: for Telegram links only. A tap on the ad does the action right inside iMe instead of only opening the link, and the button shows a label set from the link in place of your button text:
  - channel: subscribes to it, button "Subscribe"
  - group: joins it, button "Join"
  - bot: starts it, button "Start Bot"
  - mini app: opens it, button "Open"

  The label is translated into each viewer's language. It needs an account level reached through paid top-ups; a team campaign follows the team owner's level. Below it, turning it on is refused with "Auto-subscription on Telegram links needs the Pro level".

## Bid strategy

- **Auto** buys views at the platform price wherever the targeting allows. **Per click** and **Per action** aim at a target cost per click, or per conversion of the campaign's conversion type: the campaign buys the views where it expects a result at about that cost, and adjusts as its own results come in. Every strategy pays per view.
- Per click and Per action run as Auto until the campaign has enough clicks or conversions to steer by. Switching between them drops what the campaign learned about the target; changing only the target keeps it.
- Per click and Per action need an account level reached through paid top-ups, see https://ad.api.imem.me/docs/topup.md | docs_topup. A team campaign follows the team owner's level. Below it, setting them is refused with "Setting a target cost per click or per action needs the Pro level", and a campaign already set to one runs as Auto.
- Per action needs conversions coming in from the pixel, the bot or a postback, see https://ad.api.imem.me/docs/conversions.md | docs_conversions; without them the campaign stays on Auto.
- The target is an average, not a cap: a single click or action can cost more, and a low target can leave budget unspent.
- Which strategies the account can set, the level they need and the suggested targets are read in the Mini App.
- Changing the strategy or the target applies straight away, without review.

## Variants

- Title, description, button text, main media and avatar each take **1 to 3 variants**, numbered 0, 1 and 2. Variant 0 is required in every part; 1 and 2 are optional and keep their numbers when another one is removed.
- **Every impression picks one combination of the variants at random**, so every combination gets shown. Combinations start with equal chances; once a combination has enough views to judge, a higher CTR gives it a larger chance, up to twice the starting one, and its **pr** grows with it. Every placement shows the three texts, the main media and the avatar as the logo. A main media variant is only picked once its version for the placement is ready; an avatar variant is picked from the start and the ad goes out without a logo until its square version is ready.
- In the API, each part has an array of variants (`titles`, `descriptions`, `buttons`, `creatives`, `avatars`) beside the older single fields (`title`, `description`, `button`, `uploadId`, `avatarUploadId`, `wideCrop`, `squareCrop`), which stand for variant 0. **When an array is sent it is the whole set for that part** and the single field for the same part is ignored. When only the single field is sent, it changes variant 0 and variants 1 and 2 stay as they are. Campaign drafts follow the same rule.

## Media

- Images only: JPEG, PNG or WebP. There is no video.
- **Main media** is the ad image in every placement: at full size in `stories`, as a wide version everywhere else.
- **Avatar** is a square image shown as the ad's logo in every placement. A campaign without an avatar is shown without a logo until one is added.
- The platform makes a resized version for each placement automatically, from the crop when one is set and from the whole image otherwise. Changing a crop re-makes those versions.

## Placements

| Placement | Where it shows |
|---|---|
| `stories` | Full-screen ads between stories |
| `channel` | Ads in channel message feeds |
| `chats` | Ads in the chat list |
| `archive` | Ads in the archived chats list |
| `search` | Promoted results at the top of search |
| `bot` | A small banner at the top of a bot chat |
| `video_overlay` | A small card over a video playing full screen |

Placements are chosen as part of targeting.

## Statuses

A campaign is in one of `review`, `rejected`, `active`, `paused`, `finished`, `deleted`.

| Status | Meaning | What moves it on |
|---|---|---|
| `review` | Waiting for moderation. Not shown to anyone. | Approved: `active`, or `paused` if it was paused before. Rejected: `rejected`. |
| `active` | Shown to users and spending budget. | Pause: `paused`. Budget spent: `finished`. Creative edit: `review`. |
| `paused` | Stopped by the advertiser. The budget stays on the campaign. | Resume: `active`. Creative edit: `review`. |
| `finished` | The budget ran out. The advertiser gets a bot message. | Budget top-up: `active`. |
| `rejected` | Failed moderation. The unspent budget has been refunded. | Fix and resubmit, or delete. |
| `deleted` | Closed for good. | Nothing. |

**Actions by status**

- **Pause**: only when `active`. Takes effect straight away.
- **Resume**: only when `paused`.
- **Top up budget**: any status except `rejected` and `deleted`.
- **Edit**: any status except `deleted`.
- **Delete**: any status except `deleted`. It can't be undone, and the unspent budget returns to the ad balance.

An action that isn't allowed in the current status is refused with "This operation is not allowed for the campaign's current status". Only one change to a campaign runs at a time: a second change made at the same moment is refused with "Update is already in progress, please try again".

A restriction on the user refuses some of these actions too: see https://ad.api.imem.me/docs/overview.md | docs_overview.

## Editing

- **These edits send the campaign back to `review`:** a new or changed title, description or button text variant, a new media or avatar upload, and a link change. While it's in review, the ad isn't shown.
- **These apply straight away, without review:** removing a variant, changing only a crop, the daily budget limit, targeting and auto-subscription.
- An edit only changes the fields it includes. Everything else stays as it was.

## Moderation

Every new campaign, and every change to a creative, is reviewed by the iMe Ads moderators before it runs. See https://ad.api.imem.me/docs/moderation.md | docs_moderation.

## Statistics

- **Campaign totals**: views, clicks and actions.
- **Daily table**, per day and in total:
  - Views (each time the ad was shown; repeat views by the same user each count)
  - Clicks
  - Actions (completed target actions such as subscriptions, joins or bot launches)
  - Spent
  - CPM (spend per 1,000 views)
  - CTR (clicks as a share of views)
- **Combinations** (`GET user/campaign/combinations`): the top 5 combinations the campaign shows now, ranked. Combinations with enough views to judge come first, then the higher CTR, then more views; each says whether it had enough views. Each carries what it shows (texts, main media and avatar), its views, clicks and spend, its CTR, **pr** (its share of the campaign's views across its current combinations, in percent) and **cc** (cost per click, empty while it has no clicks). A combination's numbers start when it last changed: editing a variant starts the combinations showing it again from zero, and removing one drops them from the list.
- **Combination by day** (`GET user/campaign/combination/daily`): views, clicks, spend, CTR and cost per click of one combination for each of the last 10 days, today included, cut at midnight in the advertiser's timezone, and not before the combination started.
- **History**: created, edited, sent to review, approved or rejected, paused or resumed, budget topped up, finished and deleted. An edit lists the changed link, budget and targeting fields, and every variant it added, changed or removed with the text or image before and after; creation lists every initial variant. An entry a team member made is marked `member`.
