# Ads & Creatives



## Ad types

### Image Ad

- JPG, PNG, GIF, WebP
- Click URL is required
- Alt text for accessibility
- Click tracking via link wrapping

### HTML Ad

- Any HTML, CSS, and JavaScript
- No click URL required
- Links auto-rewritten server-side for click tracking
- Live preview in the editor

> For HTML ads, all `href="https://…"` links in the HTML content are rewritten server-side to pass through the tracking endpoint before redirecting to the destination URL. The original HTML content is preserved.

## Field reference

| Field | Type | Description |
| --- | --- | --- |
| `name` | Text | Internal ad name for identification in the panel. |
| `ad_type` | Choice | `image` or `html`. |
| `image` | File | Image file (image ads only). Stored in the media directory. |
| `click_url` | URL | Destination URL on click (required for image ads). Routed through the tracking system. |
| `alt_text` | Text | Image alt attribute for screen readers and accessibility. |
| `html_content` | HTML | HTML source code (HTML ads only). Any HTML/CSS/JS is permitted. |
| `width / height` | Integer | Dimensions in pixels. Should match the zone size. |
| `weight` | Integer | Rotation weight. Higher values = more frequent delivery relative to other ads. |
| `is_active` | Boolean | Manual switch. Inactive ads are not served. |

## Weight & rotation

When a campaign has multiple ads, the system picks one per page load using weighted random selection.

Example

- Ad A, weight 3: about 50 %
- Ad B, weight 2: about 33 %
- Ad C, weight 1: about 17 %

Total weight = 6 · Ad A = 3/6, Ad B = 2/6, Ad C = 1/6

> Rotation is purely weighted random – not strict alternation. Over many impressions it converges to the configured weight ratios.

## IAB standard sizes

| Format | Width × Height | Typical use |
| --- | --- | --- |
| Leaderboard | 728 × 90 | Page header / above content |
| Medium Rectangle | 300 × 250 | Sidebar, in-content |
| Wide Skyscraper | 160 × 600 | Side column |
| Billboard | 970 × 250 | Page header, large format |
| Mobile Banner | 320 × 50 | Mobile pages, app footer |
| Half Page | 300 × 600 | Sidebar, large formats |
| Large Rectangle | 336 × 280 | In-content, after article |

Ad and zone sizes don't need to match exactly, but should be compatible to avoid layout issues.
