Web Analytics 0.6.0: Your own traffic is marked and left out
Web Analytics 0.6.0 stops your own team from inflating the numbers: visits from staff, from the networks they use and from your office ranges are marked and left out of the reports, with switches to count them back in.
Three kinds of own traffic
Each page view can now carry up to three marks. Only the mark is stored, never the address behind it.
- Internal network: the address is in the
internal_networkslist in the app’s config, IPv4 or IPv6 ranges. It is app config, not a setting, so the addresses never reach the activity log. - Site staff: the signed-in user holds one of the Staff roles, Owner and Admin by default.
- Staff network: a staff member signed in or was active from that address within the last hours, 24 by default, set in Staff network, hours. This is kept in memory only.
A visit is marked as a whole: if someone signs in halfway through, the earlier page views of that visit are marked too.
Where it shows
Settings has a Your own traffic section with Leave out internal networks, Leave out site staff and Leave out staff networks, all on. Marked visits are left out of every report, the daily rollups, “Right now”, alerts and recordings; nothing is deleted. The reports get Own traffic and Bots switches next to the period. Either one reads raw events, so days older than the raw-event retention show no data in that view. The visit page names a visit’s marks.
The Visits list’s Older and Newer links now keep these switches and the page filter. Requests carrying Tidewave’s diagnostic header are ignored, so live navigation in development no longer counts twice.
Upgrading
Run mix phoenix_kit.update for migration V08, which adds one column without rewriting the table. From the day of the deploy, the numbers drop by your team’s visits; rows stored before it are not marked. Behind a mobile network, carrier-grade NAT or an office gateway, a staff sign-in leaves out everyone sharing the address for the set hours: untick Leave out staff networks or set the hours to 0.
Full release notes: Web Analytics 0.6.0
0.6.0 · 7 October 2026
⚠️ Upgrade
- Run
mix phoenix_kit.update— migration V08 addstraffic_flags smallint NOT NULL DEFAULT 0to the events table (a catalogue change, no table rewrite, no index, no backfill). - Rows stored before the upgrade are not marked. Own traffic from before it stays in the reports, and in the rollups of the days already rolled up.
- Your own traffic is now left out by default — from every report, the rollups, “Right now”, alerts and recordings — so the numbers drop by your team’s visits from the day of the deploy. Each kind has a Leave out switch in Settings.
- Visits before a staff member shows up are not marked afterwards. A visit becomes a staff member’s whole once they sign in during it, but earlier visits from the same address are not: no address is stored to match them.
- Staff networks behind NAT. A staff sign-in marks its network (an IPv4
address, an IPv6 /64) for 24 hours by default; behind a mobile network,
carrier-grade NAT or an office gateway, that leaves out everyone sharing
the address. Count them back in, or set
web_analytics_admin_network_hoursto0. - Recording chunks stored before a visit was marked stay; the visit is recorded no further from the moment it is.
- A report counting any own traffic in reads raw events (as bot traffic always has): the rollups hold only unmarked traffic, so days older than the raw-event retention show no data in that view.
- Known limit: a visit marked mid-way has its earlier hits marked too; if they fall on a day already rolled up for good (more than three hours after it ended), that day’s rollup still counts them, so for that day a report leaving own traffic out (rollups) and one counting it in (raw) can differ by those hits.
Added
- Your own traffic, marked and left out (
PhoenixKitWebAnalytics.TrafficFlags,PhoenixKitWebAnalytics.InternalTraffic). Three marks, stored as bits on each event — never the address behind them:- Internal network — the address is in
config :phoenix_kit_web_analytics, internal_networks: [...](CIDR, IPv4/IPv6; app config, not a setting, so your addresses never reach the activity log). Settings shows how many are configured. - Site staff — the signed-in user holds a role in
web_analytics_internal_roles(Owner, Admin by default; an emptied field is stored as-, no one), by the roles they really hold. A hit naming only a user is judged by a 5-minute cache of their roles, filled off the hit’s path. - Staff network — the address’s network had a staff sign-in (from
core’s session broadcast and the token’s address) or a staff request (any
path, excluded ones included — read as the response is sent, so the
plug’s place in the pipeline doesn’t matter) within
web_analytics_admin_network_hours, judged by the hours set at the time; in memory only, shared between nodes when new. Private and loopback addresses are never taken.
- Internal network — the address is in
- A visit is marked whole: later hits inherit its marks, and a mark that first appears mid-visit is written back to its earlier hits, in the same transaction and under the same lock as the hit.
- Settings: a Leave out switch per mark (all on), the staff roles, the staff-network hours, and a note on NAT.
- Reports: Own traffic and Bots switches next to the period, kept in the URL; either reads raw events, with a note that days past the raw-event retention have no data there. The visit page names a visit’s marks.
- “Right now” leaves out open pages and recent visits with a left-out mark.
Changed
- Rollups hold only unmarked, non-bot traffic (the watermark is not reset: days already rolled up keep what they had).
Reports.filter/1takesflagged:and carries the mask it leaves out (excluded_flags), so a cached report is keyed by it;recent_sessions/2takesbots:andexcluded_flags:(bots were hard-coded out).- Alerts and recordings skip marked traffic.
- The plug ignores requests with an
x-tidewave-diagnosticheader: Tidewave re-fetches each page after a live navigation in development, which counted every navigation twice.
Fixed
- The Visits list’s Older / Newer links dropped the Own traffic and Bots switches (and the page filter), so paging quietly switched them off; they now carry the whole filter.
- The test helper
LiveCase.fake_scope/1built a scope whose roles core’s own checks couldn’t read (Scope.owner?/1was false for an “owner”); it now stores role names as core does.
Web Analytics 0.6.0. Install or update: {:phoenix_kit_web_analytics, "~> 0.6"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.