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

# Campaigns

> Time-bound content initiatives under brands

Campaigns are time-bound content initiatives that run under a brand. While creators are assigned to brands, their content is attributed to specific campaigns.

## Campaign vs Brand

| Concept      | Scope                 | Creator assignment      |
| ------------ | --------------------- | ----------------------- |
| **Brand**    | The client company    | Creators assigned here  |
| **Campaign** | A specific initiative | Content attributed here |

A brand can have multiple campaigns:

* Sequential campaigns (one after another)
* Overlapping campaigns (running simultaneously)
* Platform-specific campaigns (TikTok-only, IG-only)

## Campaign lifecycle

```
┌─────────────┐     ┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│   Pending   │────▶│   Active    │────▶│   Paused    │────▶│  Finished   │
│             │     │             │     │ (optional)  │     │             │
└─────────────┘     └─────────────┘     └─────────────┘     └─────────────┘
```

### Status meanings

| Status       | Description                             |
| ------------ | --------------------------------------- |
| **Pending**  | Set up but not yet started              |
| **Active**   | Running, accepting content              |
| **Paused**   | Temporarily stopped (creators notified) |
| **Finished** | Completed, no more content accepted     |

## Campaign configuration

### Basic settings

* Name and description
* Start date and end date
* Platform targeting (TT, IG, YT, FB)

### Targets

* Placement count target
* Minimum views per placement
* Engagement rate goals

### Content settings

* Approval required (yes/no)
* Hashtag requirements
* Posting guidelines

## Content attribution

When a creator posts content, the system:

1. **Detects the post** via OAuth or scraping
2. **Identifies the creator** by social handle
3. **Finds active campaigns** for their brand
4. **Attributes to campaign** based on:
   * Platform matching
   * Date range
   * Placement count progress

### Attribution rules

```
Post detected
     │
     ▼
┌─────────────────────────┐
│ Find creator's brands   │
└────────────┬────────────┘
             │
             ▼
┌─────────────────────────┐
│ Find active campaigns   │
│ for those brands        │
└────────────┬────────────┘
             │
             ▼
┌─────────────────────────┐
│ Match by platform       │
│ (TT post → TT campaign) │
└────────────┬────────────┘
             │
             ▼
┌─────────────────────────┐
│ Attribute to campaign   │
│ with available capacity │
└─────────────────────────┘
```

## Placement rollover

When a campaign fills its placement target:

1. Campaign marked as finished
2. New posts "roll over" to the next active campaign
3. Rebalance job runs every 15 minutes

This prevents content loss when campaigns complete mid-posting.

## Contracts

Campaigns can be linked to **Contracts** for formal agreements:

```
Brand
  └── Contract (formal agreement)
        └── Campaign (content initiative)
```

Contract terms:

* `term_days` - Length in days
* Placement targets
* Compensation terms

## Campaign metrics

| Metric           | Description                 |
| ---------------- | --------------------------- |
| **Placements**   | Content pieces posted       |
| **Total views**  | Sum of all placement views  |
| **Avg. views**   | Average views per placement |
| **Engagement**   | Likes, comments, shares     |
| **Completion %** | Progress toward targets     |

## Campaign automation

Pipeline automation handles:

| Trigger                  | Action                 |
| ------------------------ | ---------------------- |
| First post in campaign   | Brand → Active status  |
| 14 days before end       | Brand → Ending Soon    |
| All placements delivered | Brand → Up for Renewal |

## Creating campaigns

Via admin frontend:

1. Navigate to brand detail
2. Click "Add Campaign"
3. Configure settings
4. Set start/end dates
5. Save

Via API:

```bash theme={null}
POST /api/internal/campaigns
{
  "brand_id": 123,
  "name": "Summer 2026",
  "start_date": "2026-06-01",
  "end_date": "2026-08-31",
  "platforms": ["tt", "ig"]
}
```
