# Key figures for the relaunch

Did the new UI hit the mark? These figures answer it by comparing the time after Day X with a baseline computed by the
same code. Brief from the product owner and the strategy work, 24 Oct 2026. Groups A and B are built; C (cohorts) and the
admin view are next. The baseline is in [metrics-baseline.md](metrics-baseline.md).

## How it works

- `php artisan metrics:daily` (scheduled at 04:30) records yesterday, and fills the figures of the last 16 days that
  have become ready since. A missed night is caught up by the next one.
- `php artisan metrics:backfill --months=24 [--until=YYYY-MM-DD]` is the same code over the past, a month at a time.
  Run it at night: it reads every poll and answer of the period (about 3 minutes on a copy of production).
- `php artisan metrics:report [--from] [--to] [--frontend=all|legacy|v3] [--out=file]` prints the months as a table
  with the rates.
- The definitions live in one place, `App\Services\Metrics\DailyMetrics`. `metrics_daily` holds only absolute
  counts, one row per day and UI (`all` always; `legacy` and `v3` by the UI a poll was created in, on days where a poll
  carries that mark).
- **A figure, once written, is frozen.** A later run fills only the figures that were not ready, so a changed
  definition never rewrites the past silently. `--force` recomputes days on purpose. Then raise
  `DailyMetrics::DEFINITIONS_VERSION`; each row records the version it was computed with.
- **Ready means mature.** Poll states and answers are read 72 h after the day, poll sizes and answer rates 14 days
  after it. Until then the figure is null, and a view must not show it.

## The marks that tell the UIs apart

| What | Where | Set by |
|---|---|---|
| The UI a poll was created in | `polls.created_ui` | `POST /api/new` with the header `X-Kulibri-UI` |
| The UI a participant last answered in | `participants.answered_ui` | the answer endpoints (`/v2/participant/{id}`, `/participant/{id}` POST and PUT) with the header |
| Every switch between the UIs | `ui_switches` | the account (`PUT /api/user/ui-version`), the sticky `?ui=` link (only when it changes the cookie), the one-off `?classic=1` / `?new=1` |

A switch without an account is logged without a person: time, direction and the poll it happened on. A participant has
no account, but they are most of the people who see the UI. Both frontends send `X-Kulibri-UI` with every API call since
1 Nov 2026 (classic `shared/http.js`, the new UI `api/http.ts`); polls and answers before that carry almost no mark (in the
copy of October 2026: 8 polls and 125 participants).

## Where an account came from (`users.origin`, 1 Nov 2026)

Added for the funnel view (product owner, 1 Nov 2026): press and the new website bring visitors who convert differently
from those who come through a poll, so the figures must be readable per origin. `App\Kulibri\Metrics\AccountOrigin`:

- The first page a visitor opens (`FrontendController`) is classified and kept in the session, only the category. Rules,
  the first that fits: a `utm_source` (`presse` for "presse", otherwise `website`); a poll link `/pr/{id}...` (not
  `/pr/new...`) `loop`; a referrer on kulibri.com other than the app's own host `website` (the press links to the
  website, so heise.de arrives here); no referrer `direkt`; any other referrer `unbekannt`.
- The account takes the session's category when it is created (`User::creating`), on every way: registration, Google,
  the owner of a poll made without registering. Without such a session (token clients, an expired session) it is
  `unbekannt`. The account of an invited person is created in someone else's request and is `loop`.
- **Never changed:** a later save keeps the stored value, also null. Accounts older than the column stay null; nothing
  estimates them.
- Not in `metrics_daily` yet: the split by origin comes with the funnel view.

## Definitions (version 1)

- **Started:** every poll created that day (`polls.created_at`). A poll row is created when the editor opens, so this
  includes people who only looked.
- **A1** by the state of the poll now: `type -1` never saved, `type 0` without `options.initialised` cancelled while
  being created, `type 0` with it deleted after use, `type > 0` saved (also per type 1 to 4). "Ever saved" = saved +
  deleted after use.
- **A2:** saved polls with at least one answer.
- **Has answered:** `participants.choice <> -1` (guest list) or an option row with `preferences.value <> -1`.
- **Qualified poll:** type 1 to 4, with an owner, at least 2 participants (`temp = 0`) created within 14 days of the poll.
- **B1:** answered ÷ participants of qualified polls. **B2:** the same for polls of 20 or more participants.
  **B3:** size buckets 2–5, 6–12, 13–30, 31+.
- **B4:** a follow-up is a qualified poll whose owner had an earlier qualified poll (by `created_at`, then id). It is
  under 48 h when the earlier one was created less than 48 h before.
- **A3:** switches back to classic that stick (account or `?ui=legacy`), split into with and without an account. The
  median hours are counted from the same account's first switch to the new UI. One-off views are counted on their own.
  Before the first logged switch these figures are null, not 0.

### Added 26 Oct 2026 (admin backend, `docs/admin-backend.md`)

New fields, filled by the next run and, for the past, by `metrics:backfill` (a run fills only empty fields, so the
existing figures stay as they were; the definitions version stays 1):

- **admins_new** (read with A1, 72 h): accounts whose first saved poll (saved, or deleted after use) was created that day,
  per UI by the UI of that poll. A poll cancelled while being created makes nobody an admin.
- **cohort_admins_2_5 … _31p** (read with B, 14 days): accounts whose first qualified poll was created that day, by its
  size. Their sum is the active admins of the backend.
- **feedback_count** (the day after, `all` row only): stored feedback of that day; null before the first stored feedback.

### Added 1 Nov 2026 (funnel view)

Filled the same way (the next runs, and `metrics:backfill` for the past; definitions version stays 1):

- **polls_saved_owned / polls_with_2p_7d** (stage 2, read 7 days after the day): the saved polls (`type > 0`) with an
  owner, and of those the ones with at least two participants (`temp = 0`) created within 7 days of the poll, answered or
  not. **The denominator is not the qualified polls** (at least two participants): with that filter the rate would be
  100 % by construction. Reach, where A2 is response. (`polls.user_id` cannot be null, so "with an owner" is every saved
  poll; the condition stays as the brief says.)
- **cohort_second_7d_* / cohort_second_30d_*** (C1): of the admins whose first qualified poll was created that day
  (`cohort_admins_*`), those whose next **qualified** poll was created within 7 or 30 days, by the size of the first. The
  same "qualified" as B4, so a quick redo without participants is not a return, and "B4 falls while C1 holds" compares
  like with like. Read when the window and the 14 days that decide whether the second poll qualifies are over: 7 + 14 and
  30 + 14 days after the day.
- `metrics:daily` looks back 46 days (the longest wait, plus two) and skips a day whose ready figures are all written.
  The same migration adds an index on `polls.created_at`: without it every day read the whole table (54 s instead of
  2.4 s per day on the local copy).

### Added 2 Nov 2026 (the participants' view of polls)

`poll_views_created_new` / `_classic` and `poll_views_switched_new` / `_classic`, from the log `poll_ui_modes` (details in
`docs/ui-rollout.md`, "Measuring"); the `all` row only, the day after, null before the first logged change. Run
`php artisan migrate`, then `metrics:backfill` fills the days since the log began (30 Oct 2026).

## Real polls and the participations polls bring (28 Nov 2026)

Three figures per day about the polls **created** that day, the `all` row only, for the trends in the head of the backend
(product owner, 28 Nov 2026), all read 14 days after the day:

| Field | Meaning |
|---|---|
| `polls_real` | the **real** ones: the "big poll" of `RealAdmins` (types 1 to 4, more than 3 participants besides the owner in the first 14 days) |
| `polls_saved_14d` | the saved ones (`type > 0`) |
| `poll_participations` | the participant rows the saved ones got in their first 14 days, invited or answered; without the owner's own row and `temp` rows |

**Stored after 72 h or 14 days, shown at once.** The head of the backend does not wait: for the newest 21 days, today
included, a figure that is not stored yet (`admins_new`, `registrations` and the three above) is counted from the data as it
is when the page is opened (`DailyMetrics::live`). The 72 hours came from the answer rate of the funnel (A2) and mean little
for first tries: in the copy of production at least 91 % of the saved polls of January to June 2026 were saved within a day of
being started, 94 % within three. What the nightly run stores, and the other views, stay as they were.

The head shows the participations and their average per saved poll (`poll_participations` ÷ `polls_saved_14d`): numerator
and denominator are the same polls.

**Deploy:** `php artisan migrate`, then `php artisan metrics:backfill --months=28` (at night): 60 weeks and the year before
them need a bit more than 26 months.

**Caveats.** A poll deleted before its day was computed is counted in none of the three (its type is gone), and since
27 Nov 2026 the participant rows of a deleted poll are removed after 30 days (`docs/data-deletion.md`). Weeks computed
afterwards therefore miss them, so the year before can be somewhat lower than a nightly run would have recorded. In the copy
of production about one in ten saved polls of 2024 and 2025 was deleted later. Bring lists (type 5) count as saved polls,
not as real ones, as for real admins.

## Where new polls come from (28 Nov 2026)

Which hint brings people to a new poll (product owner, 28 Nov 2026). Live figures, no nightly run.

| Place (`polls.created_from`) | How it is known |
|---|---|
| `poll_new` | the "new poll" button on the poll page of the new UI (bottom right; on a phone in the bottom bar): `?src=poll_new` |
| `poll_classic` | "Neues Projekt" top right on the classic poll page: `?src=poll_classic` |
| `dashboard` | "new poll" on the dashboard of the new UI: `?src=dashboard` |
| `website` | no `?src=`, the first page of the visit, and it came from kulibri.com, www.kulibri.com or home.kulibri.com, or carries `utm_source` |
| `other` | everything else, e-mail links included (they carry no name yet) |
| `copy` | a copy of a poll made in the new UI; shown with `other` |

- The new-poll page counts each opening (`POST /api/new-poll-entry`, once per history entry; `new_poll_entries` holds a
  number per day and place, nothing about the person) and sends the place with `POST /api/new`
  (`App\Kulibri\Metrics\NewPollSource`).
- `GET /api/admin/new-poll-sources`, section "Woher neue Umfragen kommen" under the head: for the running week, the last week
  and the last four weeks the openings, the polls started and saved there, and the **first tries** among the saved ones (the owner's first
  saved poll).
- **Limits.** Only the new-poll page of the new UI counts and sends the place; during the rollout it serves everybody.
  A creation on the classic new-poll page, or by an API client, is `other`. A poll saved later counts when it is saved.
  Openings by link checkers that run scripts count too.
- **Deploy:** `php artisan migrate`. Counting starts then; until then creating a poll works as before.

## Funnel view (admin backend, tab "Kennzahlen")

`GET /api/admin/funnel` sums the days per ISO week (Monday to Sunday), for the whole site and per UI; a week's figure is
null until all seven days of it are ready. The rates are computed in the browser (`frontend-v3/src/utils/funnel.ts`):

| Stage | Rate |
|---|---|
| 0 started | `polls_started` |
| 1 saved | (`polls_saved` + `polls_deleted_after_use`) ÷ `polls_started` |
| 2 reached | `polls_with_2p_7d` ÷ `polls_saved_owned` |
| 3 answered | `participants_answered` ÷ `participants`; 3b the same for polls of 20 or more |
| 4 second poll | Σ `cohort_second_30d_*` ÷ Σ `cohort_admins_*`, and per size of the first poll |

Watchers: switches back to classic (count, and the median of the days' median hours), polls set back to classic by their
admins (since the rollout the one that counts), follow-ups under 48 h (B4), the
share of qualified polls of 13 or more participants (the market-against-product test), new active admins (Σ
`cohort_admins_*`), server errors (not recorded yet). Each line shows its own newest ready week and names it; a chosen
week shows that week on every line. Columns: total, new UI, classic, the week before, the same week 52 weeks earlier, and
the change against it (percentage points for a rate, percent for a count). Not shown: Premium, registrations, feedback
and the median size.

**The switch by origin** (2 Nov 2026): "Alle", "Nur Loop", "Nur Website + Presse". The nightly run writes two more rows per day
next to the UIs, `origin_loop` and `origin_web` (website and press together), with the same figures for the polls whose
owner has that origin (`users.origin`), only on days where such an owner created a poll (`DailyMetrics::ORIGIN_ROWS`).
`GET /api/admin/funnel?origin=loop|web` sums them per week; the readiness comes from the `all` row, a day without such a row
counts 0, and weeks that began before the first origin row are unknown. The columns per UI and the figures without a poll
(switches, poll views) stay empty there. There is no year before for an origin: the origin is recorded since 1 Nov 2026,
for new accounts only.

### What differs from the August analysis

- **"Has answered" no longer counts an option row with -1.** Every option of a date poll gets a row with -1 as soon as
  the participant exists, also for people who were invited and never answered. With the August definition the answer
  rate is about 96 %; correctly it is about 83 %. `participants_with_preference_row` keeps the August figure for comparison.
- **Poll sizes count participants of the first 14 days, not the poll's lifetime.** Otherwise the nightly run (which sees
  14 days) and the backfill (which sees everything until today) would not agree. B4 comes out the same: 21.9 %.
- The backfill reads today's state of a poll and its answers. The nightly run reads it after 72 h or 14 days. A poll
  saved or answered only later counts in the backfill and not in the nightly run; the effect is small.

## Virality: new admins and accounts who become real admins (27 Nov 2026)

Brief from the product owner, 27 Nov 2026: many accounts only try the app, so "admin" says little. The growth figures are read
against a **real admin**, and the first question is how many new admins and new accounts become one. The definition lives in
`App\Services\Metrics\RealAdmins` and nowhere else.

- **Big poll:** a poll of types 1 to 4 with an owner and **more than 3** participants besides the owner. The owner's own row and
  `temp` rows (visitors who never gave a name) do not count; participants count over the poll's first 14 days
  (`SIZE_DAYS`), like the poll sizes of group B, so the nightly run and the backfill agree.
- **Real admin:** an account with at least **2 big polls**. It became one on the creation date of its second big poll.
- The "active admin" of the funnel view (first qualified poll, at least two participants) stays as it is, so older figures
  still match. A real admin is the stricter test.

New fields in `metrics_daily` (migration of 27 Nov 2026; filled by the next runs and, for the past, by `metrics:backfill`; the
definitions version stays 1, nothing existing is changed):

| Field | Meaning | Ready |
|---|---|---|
| `admins_new_real_30d` / `_90d` / `_180d` | of the admins whose first saved poll was created that day (`admins_new`), those who became real admins within that many days of it; per UI and origin row like `admins_new` | window + 14 days |
| `registrations` | accounts created that day (`users.created_at`); `all` row only (an account has no UI) | 72 h, with A1 |
| `registrations_real_30d` / `_90d` | of those accounts, the ones that became real admins within 30 / 90 days of the creation; `all` row only | window + 14 days |
| `real_admins_new` | accounts whose second big poll was created that day; `all` row only | 14 days |

The 14 days are those that decide whether the last poll in a window is big. `metrics:daily` now looks back 196 days
(180 + 14 + 2); a day whose ready figures are all written is skipped, so only the first run after the deploy is long (the
backfill reads about 0.7 s a day on a copy of production). Figures once written are frozen as everywhere else.

**Deploy order.** The deploy has no migrate step, so for a while the code can be newer than the table. That is safe: the funnel
endpoint selects only the columns that exist (a figure without its column reads as not ready) and the nightly run writes only
those. Run `php artisan migrate` and then `php artisan metrics:backfill`; the new figures fill in from the next run on.

### The viral factor (27 Nov 2026)

Who brings the new real admins? Of the accounts that became real admins in a quarter: how many had taken part in the poll of another
admin before their first saved poll. It is an **attribution, not proof of a cause**: somebody who took part may have become an admin
anyway.

- **The table `admin_referrals`** (migration `2026_11_27_100000`): a row per admin, written once by `php artisan metrics:referrals`
  72 hours after the account's first saved poll and then frozen (`App\Services\Metrics\AdminReferrals`). `referrer_id` is the owner of
  the **earliest** poll of somebody else the account took part in before that first poll (with a name: `temp` rows and the owner's own
  row do not count), with the poll, the day and `gap_days`; null if there is none. `real_since` is when the account became a real
  admin (the date of its second big poll), set once. No window is stored: "ever" and "within 180 days" are filters on `gap_days`.
- **Scheduled at 05:30**, after `metrics:daily`. The nightly run looks back 30 days, so a missed night is caught up;
  `metrics:referrals --all` reads the whole history (the first run after the migration, it reads a lot: run it at night).
- **K** = the new real admins that another admin's poll brought ÷ the real admins at the start of the quarter: how many new real
  admins 100 real admins bring about in a quarter (K = 0.020 is 2). K of 1 or more would be growth that carries itself. Shown for the
  four quarters of the growth table (`App\Services\Metrics\ViralityQuarters`, `virality` in `GET /api/admin/funnel`) as the share and
  the number of the new real admins, with K, "ever" and "at most 180 days before". A real admin is known 14 days after the second big
  poll (the poll's first days decide whether it is big), so a young quarter is counted up to that day and says so ("bis 12.11.").
  Not for one origin (an attribution has none), and empty before the migration has run.
- **Reference (copy of production, Q1 and Q2 2026):** about 270 and 240 new real admins a quarter, 3,300 and 3,570 real admins at the
  start. Of the new real admins 20 % and 29 % had taken part in another admin's poll first, but only 10 % and 11 % within 180 days
  (6 % within 60): the way from taking part to the first own poll mostly takes months (the average gap is 234 days), so a short
  window would underrate the channel. K ever about 0.017 to 0.020, within 180 days about 0.008. 100 real admins bring about 2 new real
  admins a quarter: the growth does not carry itself.
- **Limits:** 7.8 % of the participants have no account (open link without an invitation) and cannot be attributed, and a person who
  took part under another address is not found: the values are a lower bound. The earliest poll is taken, not the one that mattered
  most.
- **Deploy order:** deploy, `php artisan migrate`, then `php artisan metrics:referrals --all` (at night). Until then the section is
  not shown and nothing else is affected.

#### Organic and referred new admins (27 Nov 2026)

The head of the backend (`GET /api/admin/overview`, `AdminReferrals::perDay`) splits the new admins of each day by the same
attribution: **referred** (`referrer_id` set: took part in somebody else's poll before the first own one) and **organic** (nobody
brought them). By the day of the first saved poll, the day `admins_new` counts them on: on the copy of production the two add up to
`admins_new` on every day from June to October 2026. A day counts once the table covers it: from the day of its first row up to the
day before (newest `created_at` − 72 h); other days are null, and before `metrics:referrals --all` all of them are.

"Organic" is an **upper bound**. Measured on the copy of production (27 Nov 2026, 18,507 organic of 21,181 new admins, 87 %): an
invitation by e-mail creates the account at once, so these admins are already attributed (2,665 of the 2,674 referred ones were
invited first, none of the organic ones). An anonymous participation cannot be matched by its name: the same name turned up in a
poll before the first own one for 5,770 organic admins, and for 5,766 when each admin was given the name of the next admin (chance;
1.3 % against 1.3 % for full names). Estimate from the 7.8 % of participations without an account, if those people become admins as
often as the others: about 230 referred admins are counted as organic, about 1 %.

#### The most viral admins (27 Nov 2026)

`GET /api/admin/virality/leaders?period=12m|all` (`App\Services\Metrics\ViralLeaders`, kulibri admins only: it shows names and
addresses), the table under the viral factor. The top 25 admins whose polls brought the most real admins (`admin_referrals`, the same
attribution), ranked by the real admins brought that became real in the period (the last 12 months by default, or ever), then by the
real admins brought ever, then by the admins brought. Per admin: the real admins in the period and ever, all the new admins brought,
**the people reached** (the accounts that took part in their polls with a name, not as the owner; every account once) and the polls
of types 1 to 4 they own. The **quote** is the real admins brought ever ÷ the people reached: a small group with a high quote
(user 4234 on the copy of production: 7 of 65, 10.8 %) is not the same as a big organiser with a low one (172217: 4 of 470, 0.9 %).
There are no labels such as "volume" or "efficiency": a threshold would be an opinion, the table shows the numbers. Same limits as
above: an attribution, a lower bound. The leaders are empty before the migration has run.

**The admin backend** (`GET /api/admin/funnel`, tab "Kennzahlen", section "Wachstum") reads them per ISO week with the same
rules as the funnel: null until all seven days are ready, the account figures only in the total column and null (not 0) in a
UI column or for an origin, where accounts have no split before 1 Nov 2026. The panel shows (`GrowthPanel.vue`, rules in
`frontend-v3/src/utils/funnel.ts`):

- **The table by calendar quarter** (product owner, 27 Nov 2026): the last four quarters, the running one included, with the new
  admins and how many of them became real admins within 30, 90 and 180 days, absolute and in percent. The server sums it from the
  daily rows (`App\Services\Metrics\GrowthQuarters`, in `quarters` of `GET /api/admin/funnel`), so the quarters are exact; a week
  can straddle two. A window is ready for a day only after its length plus 14 days, so the late days of a young quarter are not
  ready when the early ones are. A cell sums the days of the quarter from its first up to the last day that is ready for its
  window and names that day ("bis 15.08."): the share stays comparable, the number is smaller. A figure is never summed over
  unready days, and a window with no ready day is empty, not 0. A day without a row ends the sum there. For one origin the
  readiness is still the 'all' row's, a day without an origin row counts 0, and a quarter that began before origins were known
  is empty.
- **A trend line per figure:** the last 26 weeks as a moving average over 4 weeks (one week of a few hundred admins swings
  a lot), the newest ready week, the year before and the change against it.

**Reference on the copy of production (6 Oct 2026; data until July 2026 only, see below):** about 12 to 14 % of new admins end up
real admins, the share within 30 days rose from about 6.5 % (mid 2025) to 8 to 11 % (2026). Of all new accounts about 0.4 % become
real admins within 30 days and 0.6 % within 90 days, flat over two years (4,000 to 7,500 new accounts a month, 70 to 130 new real
admins a month). One week of January 2026 through the nightly code: 154 new admins, 7 / 14 / 19 real within 30 / 90 / 180 days,
the same as an independent count. The figures are lower than a first ad-hoc count (Jan 2026 cohort: 5.9 / 9.5 / 11.9 % against
7.7 / 11.9 / 14.3 %) because the definition counts only the participants of a poll's first 14 days and a window is "within",
not "up to and including".

**Caveats**
- Most new accounts are invited people (`getInvitedUserId` creates an account for every invited address) who never meant to become
  admins, so the account rate is a floor. `users.origin` could split them but exists only for accounts since 1 Nov 2026.
- The copy of production used for development is almost empty from August 2026 (27 new accounts in August against 3,513 in
  July); no cleanup job explains it. Read the 2026 figures on production after the backfill.
- Not built yet: chain depth (do the admins that were brought bring others) and the concentration of the recruiters (how much of
  the growth the top 10 and the top 100 bring).

## Not covered (yet)

- Group C: `cohort_admins_*`, `cohort_second_*` and `feedback_count` are filled; registrations and Premium columns
  exist, not filled.
- Server errors per 1000 calls: not in any table; read from the logs if needed.
- A1 per type covers saved polls only: an unsaved poll has no type yet.
