One day of pre-aggregated totals per site — what survives after raw events are pruned.
PhoenixKitWebAnalytics.Retention writes one row per (date, site) for
completed days, then deletes raw events past the retention window. Reports
read raw events when they are still there and fall back to these rows for
older days, so the long-range trend line outlives the raw data.
Why only totals
visitors is a distinct count for that day, and distinct counts don't
add up: summing two days of visitors overstates the real number whenever
someone visited on both days. Treat these columns as per-day facts, never as
something to sum across rows. Per-dimension breakdowns (top pages,
referrers, …) are only ever computed from raw events — once a day is pruned,
its breakdowns are gone by design.
site is "" (not NULL) when a hit had no host, so the unique index on
(date, site) actually constrains those rows.
Summary
Functions
Average session length in seconds, or nil when the day recorded no
sessions.
Bounce rate as a percentage, or nil when the day recorded no sessions.
Changeset for a daily rollup row.
Types
Functions
Average session length in seconds, or nil when the day recorded no
sessions.
Bounce rate as a percentage, or nil when the day recorded no sessions.
@spec changeset(t(), map()) :: Ecto.Changeset.t()
Changeset for a daily rollup row.