Web Analytics 0.3.0: Visits, a Right now page, session recordings and alerts
Web Analytics 0.3.0 grows the PhoenixKit visitor analytics from page counts into visits: who is on the site right now, what each visit did, optional replays of a visit, behaviour-based bot checks and alerts when something happens.
Visits and Right now
The LiveView hook now records clicks, form submits and the moment a visitor leaves, next to live navigation, straight from the socket. Page views are grouped into visits, and the new Visits page lists them, each with a timeline of what happened. The new Right now page shows who is on the site at this moment. Pages, Acquisition, Technology and Events are rebuilt on the same data.
Client script and recordings
An optional client script adds outbound and download clicks, scroll depth and exits from pages that are not LiveView. It sets no cookies and stores nothing in the browser. It is off until Accept the client script is ticked. With Record visits on, the visit page can replay a session: pointer movement, clicks and scrolling, as positions only, never text or form values. You choose the share of visitors recorded and how many days recordings are kept.
Bots, rollups and alerts
Spot bots by behaviour flags a browser under automation, page views faster than a person reads, and visits that never ran JavaScript. Completed days are rolled up into daily totals, and raw events past Keep raw events, days are pruned hourly without losing the trend. The Alerts section sends PhoenixKit notifications for new visitors, chosen events and new sign-ups, with an hourly cap.
Fixes
- The visitor-hash secret was written in plain text to the activity log. It is now stored under a key core treats as secret.
- One-time tokens in sign-in, password reset and confirmation links were stored and shown in the Pages report; they are now stored as
:token. - Excluded paths and declared bots no longer appear under Right now.
- A NUL byte in a path or parameter no longer loses the hit, and monthly charts no longer lose buckets east of UTC.
The admin pages now come in Estonian and Russian.
Upgrading
Web Analytics 0.3 needs PhoenixKit 2.38 or later. Run mix phoenix_kit.update for migrations V02 to V06. The LiveView hook only records on pages whose live session has {PhoenixKitWebAnalytics.LiveHook, :track_navigation} in its on_mount. Visitor IDs restart once, because the hash secret has a new key. The old web_analytics_hash_salt setting can be deleted, and earlier activity-log entries for it hold the old value in plain text: purge them.
Full release notes: Web Analytics 0.3.0
0.3.0 · 1 October 2026
⚠️ Upgrade
- Run
mix phoenix_kit.updatein the host — migrations V02–V06 add the session, rollup and recording columns/tables (each step is lock-light; the session-start backfill runs in batches from the retention pass, never in the migration). Requiresphoenix_kit ~> 2.38. - The visitor-hash secret moved to
web_analytics_hash_secret(see Fixed). A new one is generated on first use, so visitor IDs restart once. The oldweb_analytics_hash_saltrow is no longer read and can be deleted; earliersetting.changedactivity entries for it hold the old value in plaintext — purge them.
Added
- Server-side tracking: a LiveView
on_mounthook records live navigations, interactions (allow-listed params only) and exits straight from the socket;LivePresencepowers the new Right now page. - Sessions and a per-session timeline; Pages, Acquisition, Technology and Events reports rebuilt on shared dimensions.
- Optional client script (via
js_sources/0): outbound/download clicks, scroll depth, exits from non-LiveView pages. No cookies or storage. - Optional session recordings with a replay player on the visit page (coordinates and element positions only — never text or form values).
- Behavioural bot signals (automation flag, page-view speed, no JavaScript).
- Daily rollups (
daily_stats,daily_dims) read together with raw events, a single-flight report cache, and hourly retention that never prunes past the rollup watermark. - Website activity alerts (new visitors, tracked events, sign-ups) routed through core’s notifications.
Adminmodule: every operator mutation is logged toPhoenixKit.Activity.- Estonian and Russian translations.
Fixed
- The visitor-hash salt was written in plaintext to the permanent activity
log (and again on every rotation), because core only withholds values of
keys whose name marks a secret. The key is now
web_analytics_hash_secret. - Rollup-backed reports (
overview,timeseries,sites) raised on a database error instead of degrading to empty results. - Monthly chart buckets vanished when the database session time zone was east of UTC.
- One-time tokens in core’s route paths (
/users/reset-password/:token,/users/confirm/:token, magic-link, QR-login, confirm-email, access links) were stored, shown in the Pages report and put into alert text; they are now stored as:token. - Excluded paths and declared bots appeared under “Right now” and wrote leave events.
- “Tracked events” alerts were forgeable and uncapped; alert text could carry a
visitor-crafted
utm_sourcesentence; crawlers alerted with bot tracking on. Event alerts now have their own hourly cap, visitor-side text is cleaned, and bots never alert. - A page that only saw interactions listed as a zero-view top page until its day was rolled up.
- The rollup watermark was written once per rolled day (one permanent
setting.changedentry each); it is now written once per pass. - A NUL byte in a path, campaign parameter or event value lost the whole hit.
- The body-size limits on the beacon and recording endpoints only applied to
text/plain; a JSON body over the limit is now dropped too. - Settings errors named six fields in English only; 23 empty
enstrings filled.
Web Analytics 0.3.0. Install or update: {:phoenix_kit_web_analytics, "~> 0.3"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.