# `web@1`: search, site traffic, creator audiences, content and campaigns

Version **1.2.0** · published 2026-12-02 · MIT · boards: search-traffic, direct-booking-funnel

One row of `search_performance` is the clicks, impressions and impression-weighted position of one site for one period
and one grain (the whole site, or one query, page, country, device or a combination). One row of `traffic` is the same for
an analytics tool's visits, pageviews and visitors. `exports` says where every row came from, which dates it covers and
whether the source cut the list short. Search Console files and its API, Plausible files and its API, and a generic CSV
provide inputs for Search & Traffic. Version 1.1 adds optional reporting tables for creator and marketing exports.

## The grain rule (read this first)

- Every fact row covers a **period**, `date_from`..`date_to` inclusive, and is broken down by exactly the dimensions in
  **`dims`** (a sorted comma list from `vocab/dims.csv`, or `site` for no breakdown: the whole site). A dimension not in `dims` is summed over. A dimension in `dims`
  whose column is NULL was not reported (an anonymised query).
- **Rows of different `dims` are different views of the same traffic. Never add them together.** Query rows leave out
  anonymised queries and the long tail below the row cap; Search Console aggregates page rows *by page* and every other
  view *by property* [K: Search Console help, "About data aggregation"], so pages need not sum to the site total. **Site
  totals come only from `dims = 'site'`.**
- **Never average averages.** Search rows store `clicks`, `impressions` and `position_sum` (average position x
  impressions): over any set of rows of one grain, CTR = Σclicks / Σimpressions and position = Σposition_sum /
  Σimpressions. Traffic rows store `visits`, `pageviews`, `bounces` and `visit_duration_s` (total): bounce rate =
  Σbounces / Σvisits, average visit = Σvisit_duration_s / Σvisits.
- **Visitors are not additive.** A row's `visitors` are unique people in that row's period. Adding daily or monthly
  visitors counts a returning person more than once; a board that does it must say so.
- **Absent is not zero.** An export whose `capped` is 1 listed only its top `row_cap` rows: an item missing from it is
  unknown. A board may treat absence as zero only when the export that would have held the item was not capped.
- **One source per site and kind.** A site's search rows come from one source (Search Console files, or the API), its
  traffic rows from one source. Within a source, a later export of the same period and grain replaces an earlier one
  (Search Console revises recent days), and an identical row seen twice counts once.

## Conventions
- Dates `YYYY-MM-DD`, the source's reporting days (Search Console: US Pacific time [K]; analytics: the site's `tz`).
- Pages: the URL path without scheme, host, query string or fragment, with no trailing slash except `/`. `www.` and the bare
  domain are one host; a page on another host keeps it: `//shop.fernhill-garden.example/seeds`.
- Countries: ISO 3166-1 alpha-2 (`vocab/countries.csv` maps Search Console's English names and the API's lower-case
  alpha-3 codes; `ZZ` = unknown region). Devices: `desktop`, `laptop`, `mobile`, `tablet`.
- IDs: `row_id` = the first 16 hex characters of the sha1 of the grain key (site, search type, period, dims and every dimension column, NULL as ''); the
  same item for the same period and grain is one row. `export_id` = `<source>:<source_ref>`.
- Provenance: every fact table has `source`, `source_ref` (file:line, `zip!member:line` inside a zip, or the API
  request), `export_id` and `imported_at` (left out of `data_hash`). `traffic.confidence = derived` marks bounces or
  durations rebuilt from a rate x visits.

## Sources that fill it
| Source | Lane | Layout | What it fills |
|---|---|---|---|
| Search Console, Performance → Export → Download CSV | 1 | `gsc-export`: a zip with one CSV per tab (Queries, Pages, Countries, Devices, Search appearance, Dates, Filters) [V 2020 Google blog: the tabs; K: member names and headers `Top queries,Clicks,Impressions,CTR,Position`] | `search_performance` (Dates → `dims = site` daily; each other tab → its dim for the export's period), `exports` (row cap 1,000 per tab) |
| Search Console export in Compare mode | 1 | `gsc-compare`: the same tabs with two columns per metric (`<period> Clicks`) [K, unverified] | two periods of the same grain; the dates must be given in inputs (the file names the periods only by label) |
| Search Console API `searchanalytics.query` | 2 | daily rows per dimension set (`date` plus query, page, country, device), `rowLimit` ≤ 25,000 with `startRow` paging; anonymised queries are left out [V 2026-11-29] | `search_performance` daily, `exports` per request |
| Plausible dashboard export (Download CSV) | 1 | `plausible-dashboard`: one CSV per report; `visitors.csv` per interval, the rest totals for the dates chosen, top 300 rows (pages 100) [V plausible.io/docs/export-stats 2026-11-30; K: column names] | `traffic` (visitors → `dims = site` daily; sources, pages, entry pages, countries, devices, browsers, OS → their dim), `conversions` |
| Plausible site data export (Export all stats to date) | 1 | `plausible-data-export`: `imported_visitors_YYYYMMDD_YYYYMMDD.csv` and friends, one row per day per item, bounces and visit_duration as totals [V plausible/analytics lib/plausible/exports.ex 2026-11-30] | `traffic` daily for every dim |
| Plausible Stats API v2 `POST /api/v2/query` | 2 | `time:day` rows with metrics visitors, visits, pageviews, bounce_rate, visit_duration [V 2026-11-29] | `traffic` daily (bounces and durations `derived`) |
| A spreadsheet in the web@1 columns | 1 | `web-csv` | any table, rows as written |

## Creator and marketing exports (1.1)

Accounts identify a newsletter publication, podcast show, social/video channel, email list or ad account. An account
and its content or campaign identifiers are stable within the reporting platform. Scope source object ids to the
account where they are unique. A plan without source object ids can hash the natural key and a stable occurrence
identifier. Fact ids use the grains in the field reference below. Pick one source owner per account and dataset.
When the same source revises a report, replace its row for that grain. Provenance keeps the connector id, file and
row number or object reference, and UTC import instant. A connector must keep subscriber names, email addresses
and other individual identifiers out of these tables. Aggregate individual subscriber export rows before writing
them, and keep account lists separate.

- **Newsletter Growth and Creator Analytics.** Account totals have a NULL acquisition source. Breakdown rows are a
  separate view of that audience. Use joined minus left for net growth in disjoint periods. Ending audience size is
  a snapshot. Unique listeners, opens and clicks count distinct people in their own period and are non-additive across
  overlapping periods. Use newsletter delivery counts as denominators where the same row supplies them; absent
  counts stay NULL. Views and engagement are platform-defined and cross-posts have independent ids.
- **Content Calendar.** The calendar schedule stays in `calendar@1`. `creator_content` carries a source's planned
  reporting date, actual publication date and status when known. Compare the dates to measure publishing cadence
  and keep scheduled-but-unpublished content distinct from a published item.
- **Podcast.** Compare the first N reporting days across episodes using the same `window_days`. Day one includes
  the publication day in the account's timezone. The first-day and first-five-day rows are overlapping cumulative
  windows. Choose one. Show retention for one period and cohort. Compute weighted retention using available
  cohort counts for disjoint cohorts, and show a rate-only source's share at its own grain.
- **Email Campaigns.** Use one campaign period per reported snapshot. Compare sends, delivery, unique engagement
  and unsubscribes within that period. Where available, revenue per send is attributed revenue divided by sends in
  the same period. Store the source currency and omit the rate when its necessary figures are unknown.
- **Ad Spend.** Match reporting dates, currency, click and view attribution windows, and reported versus estimated
  credits when comparing campaigns. Store attribution windows in days. A NULL window is unknown, so do not compare
  it with a known window. An explicit zero means that attribution route is disabled. Compute CPA as spend divided
  by attributed conversions and ROAS as attributed value divided by spend over the same rows. A source can provide
  several attribution views of one spend figure. Choose one view before summing. Preserve fractional conversion
  credits and the source's estimate labels. A period with unknown attribution results can still report its spend.
- **Money.** Spend is a positive cost. Attributed revenue and value follow the source and can be negative after
  adjustments. Monetary rows use major units in their own currency. Use `meta.base_currency` for the reporting
  preference when any monetary figures are present. Conversion to it needs an explicit exchange-rate source.

## Bookings attributed to a source (1.2)

A site's funnel ends in a booking, not a page view. `bookings` holds one row per booking a site's booking engine or the
person's booking register recorded: its day, channel (`direct`, or the channel that took it), status and the acquisition
source the engine saw (`traffic_source`, the same names as `traffic.traffic_source`, plus UTM tags when recorded). With
`traffic` (visits by source) and `conversions` (enquiries by source) it gives visits, enquiries and bookings per source on
one grain, and the direct share of all bookings.

- **Never a guess.** A booking with no recorded source keeps `traffic_source` NULL and counts as unattributed; boards show
  that count instead of spreading it over sources.
- **No guest.** The booking reference is hashed into `booking_id`; no name, email, phone or message is kept.
- **Why here and not in rental@1.** A booking register gives a reference, day, channel, status and source, but no stay
  dates or money breakdown, so it cannot fill a rental@1 reservation honestly. `reservation_id` links the two when a
  rental@1 database is the source; channels and statuses use rental@1's values.

## Compatibility
- A board that declares `web@1 >=1.x` keeps working on later 1.x databases. The 1.1 tables are additive; web
  1.0 databases can be checked as-is, and new creator boards should pin 1.1.0 or later.
- Remixes that add only metrics, pages and `x_<owner>_` tables survive every minor.
- Breaking changes go to `web@2` with a migration and `metrics-codemod.py` (see `../../README.md`, Semver).

## Fields

<!-- fields:begin (generated from schema.sql by spec/build.py; edit the DDL comments) -->

### `meta` (required table)

Key/value facts about this database. Required: schema, schema_version, as_of, data_hash, source_built_at.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `key` | TEXT | no |  |
| `value` | TEXT | no |  |

### `sites` (required table)

One website the person owns. Search and analytics rows point at it; one site can have a Search Console property and an analytics site.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `site_id` | TEXT | **yes** | the person's id for the site, usually its domain: fernhill-garden.example |
| `name` | TEXT | no | friendly name, e.g. Fernhill Garden Notes |
| `host` | TEXT | no | main host, e.g. www.fernhill-garden.example (www. and the bare domain count as one host) |
| `search_property` | TEXT | no | Search Console property: sc-domain:fernhill-garden.example or https://www.fernhill-garden.example/ |
| `analytics_site` | TEXT | no | the analytics tool's site id (Plausible: the domain as added there) |
| `tz` | TEXT | no | IANA time zone of the analytics reports (Search Console days are Pacific time) |
| `source` | TEXT | no | who wrote the row: inputs \| gsc-api \| plausible-api |
| `source_ref` | TEXT | no | data/inputs.yaml, or the API object |
| `imported_at` | TEXT (instant) | no | ISO 8601 UTC instant (left out of meta.data_hash) |

### `pages`

Pages of a site, by normalised path. Optional facts (title, dates) from a sitemap or the person.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `site_id` | TEXT | **yes** | sites.site_id |
| `page` | TEXT | **yes** | normalised page: the URL path without scheme, host, ?query or #fragment, no trailing slash except "/"; a host other than sites.host keeps it as //host/path |
| `url` | TEXT | no | a full URL for the page, as a source gave it (https://www.fernhill-garden.example/guides/compost/) |
| `title` | TEXT | no | page title, when known |
| `published_at` | TEXT (date) | no | date first published (YYYY-MM-DD), when known |
| `last_updated` | TEXT (date) | no | date last changed (YYYY-MM-DD), from a sitemap lastmod or the person |
| `source` | TEXT | no | who wrote the row: gsc-csv \| plausible-csv \| inputs \| sitemap |

### `exports` (required table)

Every export file, export table or API request that delivered rows: what period it covers, how it is broken down, and whether the source cut it off. Absent is not zero: an item missing from a capped export is unknown, not a loss.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `export_id` | TEXT | **yes** | <source>:<source_ref>, e.g. gsc-csv:data/files/gsc/2026-10.zip!Queries.csv (readable, and the same on every import) |
| `site_id` | TEXT | **yes** | sites.site_id |
| `kind` | TEXT (vocab `export_kinds`) | **yes** | search \| traffic \| conversions (vocab export_kinds) |
| `source` | TEXT | **yes** | the source (one per site and kind): gsc-csv \| gsc-api \| plausible-csv \| plausible-api \| web-csv |
| `layout` | TEXT | no | the file layout read: gsc-export \| gsc-compare \| plausible-dashboard \| plausible-data-export \| web-csv \| api |
| `source_ref` | TEXT | **yes** | the file (zip!member for a file inside a zip) or the API request |
| `search_type` | TEXT (vocab `search_types`) | no | search exports: web \| image \| video \| news \| discover \| googleNews (vocab search_types) |
| `date_from` | TEXT (date) | **yes** | first day covered (YYYY-MM-DD) |
| `date_to` | TEXT (date) | **yes** | last day covered, inclusive |
| `period_from` | TEXT | no | how the period is known: filters (the export says its dates) \| dates_table (the export's own daily table) \| inputs (the person wrote it) \| api \| file (the rows carry dates) |
| `dims` | TEXT | **yes** | the dims its rows are broken down by (sorted comma list; 'site' = site totals) |
| `filters` | TEXT | no | JSON object of exact filters the export applied that fix a dimension, e.g. {"page": "/guides/compost"} |
| `rows` | INTEGER | **yes** | data rows in the export (before dedupe) |
| `row_cap` | INTEGER | no | the most rows the source gives for this view (Search Console UI 1000, Plausible dashboard 300 or 100), NULL = no known cap |
| `capped` | INTEGER | **yes** | 1 when rows reached row_cap: items below the cut are missing, not zero |
| `imported_at` | TEXT (instant) | no | ISO 8601 UTC instant |

### `search_performance` (required table)

Search performance: clicks, impressions and position for one period and one grain (see the grain rule above).

| Field | Type | Required | Meaning |
|---|---|---|---|
| `row_id` | TEXT | **yes** | first 16 hex of sha1 of site\|search_type\|date_from\|date_to\|dims\|query\|page\|country\|device\|appearance (NULL as ''): one row per grain and item |
| `site_id` | TEXT | **yes** | sites.site_id |
| `search_type` | TEXT (vocab `search_types`) | **yes** | web \| image \| video \| news \| discover \| googleNews (vocab search_types) |
| `date_from` | TEXT (date) | **yes** | first day of the period (YYYY-MM-DD) |
| `date_to` | TEXT (date) | **yes** | last day, inclusive (= date_from for a daily row) |
| `dims` | TEXT | **yes** | sorted comma list of the dimensions this row is broken down by ('site' = site total) |
| `query` | TEXT | no | the query as Search Console gives it (lower case); NULL in a query row = anonymised |
| `page` | TEXT | no | normalised page (pages.page) |
| `country` | TEXT (vocab `countries`) | no | ISO 3166-1 alpha-2 (vocab countries; ZZ = unknown region) |
| `device` | TEXT (vocab `devices`) | no | desktop \| mobile \| tablet (vocab devices) |
| `appearance` | TEXT | no | search appearance as the source names it (e.g. Videos, Review snippet) |
| `clicks` | INTEGER | **yes** | clicks from Google to the site |
| `impressions` | INTEGER | **yes** | times a link to the site was shown |
| `position_sum` | REAL | no | average position x impressions (sum of the topmost position over impressions), so positions re-aggregate weighted by impressions; NULL when the source has no position (Discover) |
| `source` | TEXT | **yes** | the source: gsc-csv (any Search Console file layout) \| gsc-api \| web-csv |
| `source_ref` | TEXT | no | file:line (zip!member:line) or API request |
| `export_id` | TEXT | no | exports.export_id |
| `imported_at` | TEXT (instant) | no | ISO 8601 UTC instant (left out of meta.data_hash) |

### `traffic` (required table)

Traffic from an analytics tool, for one period and one grain (see the grain rule above).

| Field | Type | Required | Meaning |
|---|---|---|---|
| `row_id` | TEXT | **yes** | first 16 hex of sha1 of site\|date_from\|date_to\|dims\|<every dimension column> (NULL as '') |
| `site_id` | TEXT | **yes** | sites.site_id |
| `date_from` | TEXT (date) | **yes** | first day of the period (YYYY-MM-DD, the site's tz) |
| `date_to` | TEXT (date) | **yes** | last day, inclusive |
| `dims` | TEXT | **yes** | sorted comma list of dimensions ('site' = site total) |
| `page` | TEXT | no | normalised page viewed |
| `entry_page` | TEXT | no | normalised first page of the visit (landing page) |
| `traffic_source` | TEXT | no | where visits came from as the tool names it: Google, Direct / None, Pinterest, a newsletter |
| `channel` | TEXT | no | the tool's channel group when it gives one (Organic Search, Direct, Referral, Organic Social, Email) |
| `utm_medium` | TEXT | no | utm_medium |
| `utm_source` | TEXT | no | utm_source |
| `utm_campaign` | TEXT | no | utm_campaign |
| `country` | TEXT (vocab `countries`) | no | ISO 3166-1 alpha-2 |
| `device` | TEXT (vocab `devices`) | no | desktop \| laptop \| mobile \| tablet (vocab devices) |
| `browser` | TEXT | no | browser name |
| `os` | TEXT | no | operating system name |
| `visitors` | INTEGER | no | unique visitors in this row's period (NOT additive across rows or periods) |
| `visits` | INTEGER | no | visits (sessions); additive across days |
| `pageviews` | INTEGER | no | pageviews; additive |
| `bounces` | INTEGER | no | visits that saw one page; bounce rate = bounces / visits |
| `visit_duration_s` | REAL | no | total seconds of those visits; average = visit_duration_s / visits |
| `confidence` | TEXT | no | NULL = as the source counted it; derived = bounces or duration rebuilt from a rate x visits (rounded) |
| `source` | TEXT | **yes** | the source: plausible-csv (either Plausible file layout) \| plausible-api \| web-csv |
| `source_ref` | TEXT | no | file:line (zip!member:line) or API request |
| `export_id` | TEXT | no | exports.export_id |
| `imported_at` | TEXT (instant) | no | ISO 8601 UTC instant |

### `conversions`

Optional: goals (conversions) from the analytics tool.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `row_id` | TEXT | **yes** | first 16 hex of sha1 of site\|date_from\|date_to\|dims\|goal\|page\|traffic_source (NULL as '') |
| `site_id` | TEXT | **yes** | sites.site_id |
| `date_from` | TEXT (date) | **yes** | first day of the period |
| `date_to` | TEXT (date) | **yes** | last day, inclusive |
| `dims` | TEXT | **yes** | 'site', or page / traffic_source (the goal itself is always named) |
| `goal` | TEXT | **yes** | the goal's name as the tool shows it (Newsletter signup) |
| `page` | TEXT | no | normalised page, when dims has page |
| `traffic_source` | TEXT | no | traffic source, when dims has traffic_source |
| `visitors` | INTEGER | no | unique visitors who converted (not additive) |
| `events` | INTEGER | no | conversions counted (additive) |
| `source` | TEXT | **yes** | the source: plausible-csv (either Plausible file layout) \| plausible-api \| web-csv |
| `source_ref` | TEXT | no | file:line or API request |
| `export_id` | TEXT | no | exports.export_id |
| `imported_at` | TEXT (instant) | no | ISO 8601 UTC instant |

### `creator_accounts`

Creator accounts (1.1). One channel, publication, list, show or advertising account on a reporting platform.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `account_id` | TEXT | **yes** | stable platform-scoped identifier, e.g. newsletter-csv:fern-notes |
| `name` | TEXT | no | display label for the publication, channel, show or account |
| `platform` | TEXT | **yes** | platform slug, e.g. beehiiv or youtube; preserve separate platform scopes |
| `medium` | TEXT (vocab `creator_media`) | **yes** | newsletter \| podcast \| social \| email \| ads |
| `tz` | TEXT | no | IANA time zone of the reporting days, when known |
| `source` | TEXT | **yes** | connector id, e.g. newsletter-csv |
| `source_ref` | TEXT | **yes** | account export or settings object |
| `imported_at` | TEXT (instant) | **yes** | ISO 8601 UTC instant; excluded from the data hash |

### `creator_content`

Scheduled or published content (1.1). A cross-post gets a distinct id for each account.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `content_id` | TEXT | **yes** | account-scoped source object id, or stable plan-row id |
| `account_id` | TEXT | **yes** | creator_accounts.account_id |
| `kind` | TEXT (vocab `creator_content_kinds`) | **yes** | newsletter_issue \| episode \| post \| video \| short_video \| livestream |
| `title` | TEXT | no | issue, episode or post title; may be absent in a metrics export |
| `status` | TEXT (vocab `creator_content_statuses`) | no | draft \| scheduled \| published \| cancelled, when the source states it |
| `scheduled_for` | TEXT (date) | no | planned publication date in the account's calendar |
| `published_on` | TEXT (date) | no | actual publication date in the account's calendar |
| `duration_s` | REAL | no | full media duration in seconds, when reported |
| `source` | TEXT | **yes** | connector id |
| `source_ref` | TEXT | **yes** | source object id or file:line |
| `imported_at` | TEXT (instant) | **yes** | ISO 8601 UTC instant; excluded from the data hash |

### `creator_audience`

Audience counts (1.1). One account, audience kind, inclusive reporting period and acquisition-source breakdown.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `row_id` | TEXT | **yes** | stable id for account, dates, kind and acquisition source |
| `account_id` | TEXT | **yes** | creator_accounts.account_id |
| `date_from` | TEXT (date) | **yes** | first reporting day inclusive (YYYY-MM-DD) |
| `date_to` | TEXT (date) | **yes** | last reporting day inclusive (YYYY-MM-DD) |
| `kind` | TEXT (vocab `creator_audience_kinds`) | **yes** | subscribers \| followers \| listeners |
| `acquisition_source` | TEXT | no | source-reported acquisition label; NULL is the account total |
| `joined` | INTEGER | no | subscriptions or follows started in the period |
| `left_count` | INTEGER | no | subscriptions or follows ended in the period, a positive count |
| `ending_count` | INTEGER | no | active subscribers or followers at the end of the period; a snapshot |
| `unique_listeners` | INTEGER | no | distinct listeners in the period; non-additive |
| `source` | TEXT | **yes** | connector id |
| `source_ref` | TEXT | **yes** | source object id or file:line; no subscriber names or addresses |
| `imported_at` | TEXT (instant) | **yes** | ISO 8601 UTC instant; excluded from the data hash |

### `creator_content_performance`

Performance of a newsletter issue, post, video or podcast episode (1.1), by inclusive reporting window.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `row_id` | TEXT | **yes** | stable id for content, dates and window kind |
| `content_id` | TEXT | **yes** | creator_content.content_id |
| `date_from` | TEXT (date) | **yes** | first reporting day inclusive (YYYY-MM-DD) |
| `date_to` | TEXT (date) | **yes** | last reporting day inclusive (YYYY-MM-DD) |
| `window_days` | INTEGER | no | first N publication days; NULL for an ordinary reporting period |
| `views` | INTEGER | no | views as defined by the platform |
| `impressions` | INTEGER | no | impressions as defined by the platform |
| `watch_time_s` | REAL | no | total watch time in seconds, a sum |
| `downloads` | INTEGER | no | episode downloads as defined by the podcast host |
| `sent` | INTEGER | no | newsletter sends |
| `delivered` | INTEGER | no | delivered newsletter messages |
| `unique_opens` | INTEGER | no | distinct recipients who opened during this window |
| `unique_clicks` | INTEGER | no | distinct recipients who clicked during this window |
| `reactions` | INTEGER | no | likes or reactions as defined by the platform |
| `comments` | INTEGER | no | comments as reported by the platform |
| `shares` | INTEGER | no | shares as reported by the platform |
| `source` | TEXT | **yes** | connector id |
| `source_ref` | TEXT | **yes** | source object id or file:line |
| `imported_at` | TEXT (instant) | **yes** | ISO 8601 UTC instant; excluded from the data hash |

### `creator_retention`

A point in a media retention curve (1.1). Values from different windows or cohorts are separate curves.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `row_id` | TEXT | **yes** | stable id for content, dates, cohort and offset |
| `content_id` | TEXT | **yes** | creator_content.content_id |
| `date_from` | TEXT (date) | **yes** | first reporting day inclusive (YYYY-MM-DD) |
| `date_to` | TEXT (date) | **yes** | last reporting day inclusive (YYYY-MM-DD) |
| `cohort` | TEXT | no | source-reported group; NULL for the complete audience |
| `offset_s` | REAL | **yes** | playback position in seconds from the start |
| `starting_audience` | INTEGER | no | size of the cohort at playback start |
| `remaining_audience` | INTEGER | no | members of that cohort still playing at this offset |
| `retained_share` | REAL | no | source-reported share (0 to 1); use counts for a weighted rollup when present |
| `source` | TEXT | **yes** | connector id |
| `source_ref` | TEXT | **yes** | source object id or file:line |
| `imported_at` | TEXT (instant) | **yes** | ISO 8601 UTC instant; excluded from the data hash |

### `creator_campaigns`

Email or advertising campaign (1.1). Campaign ids are scoped by account even when names are reused.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `campaign_id` | TEXT | **yes** | account-scoped source campaign id |
| `account_id` | TEXT | **yes** | creator_accounts.account_id |
| `kind` | TEXT (vocab `creator_campaign_kinds`) | **yes** | email \| ad |
| `name` | TEXT | no | campaign label for display |
| `sent_on` | TEXT (date) | no | reporting day of the email send when the source has a single send |
| `source` | TEXT | **yes** | connector id |
| `source_ref` | TEXT | **yes** | source object id or file:line |
| `imported_at` | TEXT (instant) | **yes** | ISO 8601 UTC instant; excluded from the data hash |

### `email_campaign_performance`

Email campaign activity (1.1) by inclusive reporting period; totals may be snapshots of an evolving window.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `row_id` | TEXT | **yes** | stable id for campaign, dates and currency |
| `campaign_id` | TEXT | **yes** | creator_campaigns.campaign_id for an email campaign |
| `date_from` | TEXT (date) | **yes** | first reporting day inclusive (YYYY-MM-DD) |
| `date_to` | TEXT (date) | **yes** | last reporting day inclusive (YYYY-MM-DD) |
| `sent` | INTEGER | no | sends as reported by the platform |
| `delivered` | INTEGER | no | delivered messages |
| `unique_opens` | INTEGER | no | distinct recipients who opened in the reporting period |
| `unique_clicks` | INTEGER | no | distinct recipients who clicked in the reporting period |
| `unsubscribes` | INTEGER | no | unsubscribes attributed to the campaign |
| `attributed_revenue` | REAL | no | source-attributed revenue in major currency units; NULL when withheld |
| `currency` | TEXT (currency) | no | ISO 4217; required when attributed revenue is supplied |
| `source` | TEXT | **yes** | connector id |
| `source_ref` | TEXT | **yes** | source object id or file:line |
| `imported_at` | TEXT (instant) | **yes** | ISO 8601 UTC instant; excluded from the data hash |

### `ad_campaign_performance`

Advertising campaign activity (1.1) by inclusive reporting period, currency and attribution basis.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `row_id` | TEXT | **yes** | stable id for campaign, dates, currency, windows and conversion basis |
| `campaign_id` | TEXT | **yes** | creator_campaigns.campaign_id for an ad campaign |
| `date_from` | TEXT (date) | **yes** | first reporting day inclusive (YYYY-MM-DD) |
| `date_to` | TEXT (date) | **yes** | last reporting day inclusive (YYYY-MM-DD) |
| `currency` | TEXT (currency) | **yes** | ISO 4217 for spend and attributed value |
| `spend` | REAL | **yes** | positive media cost in major units; 0 is a reported zero |
| `impressions` | INTEGER | no | ad impressions |
| `clicks` | INTEGER | no | ad clicks |
| `conversions` | REAL | no | attributed conversions; fractional credits are allowed |
| `attributed_value` | REAL | no | attributed conversion value in major currency units |
| `click_window_days` | INTEGER | no | lookback days for click attribution; NULL means unknown, 0 means disabled |
| `view_window_days` | INTEGER | no | lookback days for view attribution; NULL means unknown, 0 means disabled |
| `conversion_basis` | TEXT (vocab `creator_attribution_bases`) | no | reported \| estimated; describes conversions and attributed value, not spend |
| `source` | TEXT | **yes** | connector id |
| `source_ref` | TEXT | **yes** | source object id or file:line |
| `imported_at` | TEXT (instant) | **yes** | ISO 8601 UTC instant; excluded from the data hash |

### `bookings`

What a connector or importer could not read, left out on purpose, or stopped on. Bookings attributed to a traffic source (1.2): one row per booking a site's booking engine or the person's booking register recorded, with the acquisition source the booking engine saw. This is the last stage of a site's funnel after traffic (visits) and conversions (enquiries). Only the booking's day, channel, status and source are kept: never a guest's name, email or message. A booking with no recorded source has traffic_source NULL (unattributed), never a guess. A rental@1 database's reservation can be named by reservation_id; channel and status use rental@1's values.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `booking_id` | TEXT | **yes** | <source>:<site_id>:<first 20 hex of sha256 of the booking reference> (the reference itself is not kept) |
| `site_id` | TEXT | **yes** | sites.site_id of the site the booking is credited to |
| `booked_on` | TEXT (date) | **yes** | the day it was booked (YYYY-MM-DD, the site's tz) |
| `channel` | TEXT (vocab `booking_channels`) | **yes** | direct \| airbnb \| vrbo \| booking \| other (vocab booking_channels, as rental@1 channels) |
| `status` | TEXT (vocab `booking_statuses`) | **yes** | confirmed \| cancelled \| pending \| no_show (vocab booking_statuses, as rental@1 reservation statuses) |
| `traffic_source` | TEXT | no | the acquisition source as the booking engine or analytics names it (the same names as traffic.traffic_source); NULL = none recorded |
| `utm_source` | TEXT | no | utm_source, when recorded |
| `utm_medium` | TEXT | no | utm_medium, when recorded |
| `utm_campaign` | TEXT | no | utm_campaign, when recorded |
| `reservation_id` | TEXT | no | the rental@1 reservations.reservation_id of the same stay, when known |
| `value` | REAL | no | booking value in currency (major units), when the register gives it |
| `currency` | TEXT (currency) | no | ISO 4217 of value; required when value is given |
| `source` | TEXT | **yes** | the source: web-csv (a booking register CSV) \| rental-db (a rental@1 database) |
| `source_ref` | TEXT | **yes** | file:line |
| `imported_at` | TEXT (instant) | no | ISO 8601 UTC instant (left out of meta.data_hash) |

### `import_issues`

| Field | Type | Required | Meaning |
|---|---|---|---|
| `issue_id` | TEXT | **yes** | stable id: <file>:<line> or <file>:<kind> |
| `severity` | TEXT (vocab `severities`) | **yes** | info \| warn \| error |
| `kind` | TEXT | **yes** | skipped_row \| ignored_rows \| unknown_layout \| no_period \| capped \| anonymised \| filtered_export \| duplicate \| replaced \| overlap \| source_overlap |
| `file` | TEXT | no | the source file name (never its contents) |
| `line` | INTEGER | no | 1-based line in that file, when the issue is one row |
| `detail` | TEXT | **yes** | what happened |
| `handling` | TEXT | **yes** | what the importer did about it |
| `source` | TEXT | no | connector id |

### `overrides`

Corrections the person made, with the reason (platform table).

| Field | Type | Required | Meaning |
|---|---|---|---|
| `override_id` | TEXT | **yes** | stable id |
| `target` | TEXT | **yes** | table.key.column the override applies to |
| `field` | TEXT | no | column name |
| `old_value` | TEXT | no | value before |
| `new_value` | TEXT | no | value after |
| `reason` | TEXT | **yes** | why, in the person's words |
| `evidence` | TEXT | no | where it comes from |
| `author` | TEXT | no | person or assistant |
| `created_at` | TEXT | no | ISO 8601 instant |

### `annotations`

Notes on metrics and pages (platform table). Numbers only through {{metric:...}} placeholders.

| Field | Type | Required | Meaning |
|---|---|---|---|
| `annotation_id` | TEXT | **yes** | stable id |
| `target` | TEXT | **yes** | metric id or page id |
| `kind` | TEXT | **yes** | note \| caveat \| flag \| decision \| open_item |
| `body` | TEXT | **yes** | the note text |
| `author` | TEXT | no | person or assistant |
| `source_ref` | TEXT | no | where it came from |
| `created_at` | TEXT | no | ISO 8601 instant |
| `data_hash` | TEXT | no | hash of the cited metric values when written (stale when they change) |
| `status` | TEXT | no | active \| stale \| retired |

### `metric_registry`

| Field | Type | Required | Meaning |
|---|---|---|---|
| `metric_id` | TEXT | **yes** | e.g. search.queries |
| `version` | INTEGER | no | the metric's own version |
| `unit` | TEXT | no | rows \| pct \| num \| date ... |
| `params` | TEXT | no | comma list of parameters it honours |
| `description` | TEXT | no | the @desc line |
| `sql` | TEXT | no | expanded SQL |
| `test` | TEXT | no | the @test line (check that covers it) |

<!-- fields:end -->

## Vocabularies
- `countries.csv`: ISO 3166-1 alpha-2 (`value`), English name (`meaning`, as the Search Console UI export writes it),
  `alpha3` (the Search Console API's code, lower-cased there) and other names (`aliases`, `;`-separated).
- `devices.csv`, `search_types.csv`: controlled values for `device` and `search_type`.
- `dims.csv`: the dimension names allowed in `dims`, with the tables that have them.
- `export_kinds.csv`, `severities.csv`.
- `creator_media.csv`, `creator_content_kinds.csv` and `creator_content_statuses.csv` describe channels and content.
- `creator_audience_kinds.csv`, `creator_campaign_kinds.csv` and `creator_attribution_bases.csv` describe reporting rows.

## Conformance checks

1.2 adds `bookings_valid` (fail; it reads only the new table, so no 1.1 database can fail it): known site, namespaced
id, a currency with every value, and a reservation credited at most once.

See `checks.yaml`. `dashremix spec check <db> web@1` runs them after the DDL diff, the meta keys and the JSON Schema.
