Visitor analytics

lazysite records its own traffic (SM140), so visitor statistics work out of the box - no web-server log access, no cookies, no JavaScript beacon. The processor appends one compact JSON line per request to lazysite/logs/access-YYYYMMDD.jsonl, and the Visitor Stats extension aggregates it for the manager's Visitor statistics page.

The first-party access log

Every request the processor serves is recorded: page views (cache hits included), clean-URL 404s and scanner probes. Saved-page previews and draft renders are left out. The installed app's background refreshes and manifest fetches are recorded on their own channels (app and registry) and counted apart from page views. Each line carries the time, path, status, truncated user-agent, external referrer, bytes, channel (operator traffic is marked and excluded from visitor statistics) and the request Host, so the traffic can be read per domain.

The log is anonymised at write: the visitor field is a daily-salted keyed hash of the visitor's address (read through trusted_proxies behind a front proxy) - the same visitor yields the same key within a day, so unique visitors are "distinct daily visitors" - and the IP itself is never stored. Attacker-controlled fields are stripped of control characters and length-capped against log injection. Daily files are pruned after retention_days (default 90); writes are single O_APPEND appends that never block or break serving.

Traffic classes

Because there are no cookies and no JS, every classification is a log-only heuristic over user-agent, path and status, and so an estimate. Requests are classed as:

  • unattributed - traffic no automation rule matched. This is the headline audience and an upper bound on people: totals, top pages, trend and referrers count this class
  • no_agent - requests that sent no user-agent at all
  • ai - AI assistants and model fetchers (GPTBot, ClaudeBot, PerplexityBot, ...), plus non-browser clients on the automation endpoints
  • bot - crawlers, monitors and headless/automation tooling. A source making more than five page views, each under ten seconds after the last, is moved here too and counted in bot_paced
  • noise - probe paths (wp-login.php, .env, any .php), secret-fishing, infrastructure fetches (favicon, robots, sitemap, feeds) and 404ed build-manifest probes
  • scanner - every request from a visitor that probed the site: one that hit a probe path, or asked for scanner_404_paths different missing pages within scanner_404_minutes
  • logged_in - operator activity on the manager surface, shown on the manager page only and left out of the export

Responses of 400 and above are counted separately (error_hits) and leave the visit count. Referrer spam is dropped from the external-referrers report, and self-referrers count as on-site navigation. Your own automation is classed as bot by convention: give it a user-agent containing lazysite-agent/<partner-id>.

Configuration

Settings live in lazysite/stats.conf, edited on the Visitor Stats extension's Configure page:

Key Default Meaning
first_party true Record first-party traffic; off = read the web-server log instead
retention_days 90 Days of first-party log files kept
window_days 30 Reporting window for the statistics page
top_n 15 Rows in the top-pages / top-referrers tables
ai_user_agents - Extra UA substrings to count as AI
noise_paths - Extra path prefixes to treat as noise
scanner_404_paths 5 Different missing pages that mark a visitor as a scanner
scanner_404_minutes 5 Window, in minutes, for those missing pages
search_terms off Record internal search terms used by at least three different visits; once on, they are also shared through analyse_visitors

The web-server access log serves as the fallback source when no first-party data exists (and its error log as a summarised diagnostics tier); log paths are auto-detected or set by the server owner at install time, outside a site manager's reach.

Rollups

Each day's figures are also kept as durable rollups under lazysite/stats/ (one file per day, monthly rollups and an index), which outlast the raw log files pruned by retention_days. Visitor trails (the order of pages within a visit) are kept for 30 days by default.

With the daemon extension enabled (it ships disabled), the scheduler runs the stats-rollup job every hour under the analytics capability, so each day is closed whether or not anyone reads the statistics. Without it, the rollup runs when the statistics are read.

The analyse_visitors action

analyse_visitors (control API and MCP, gated by the analytics capability) returns a sanitised analytics export for AI reasoning: totals, per-class shares, a per-day series, top pages, referrers, status codes and a capped event stream - never a raw log line, a filesystem path or a visitor IP. Ingestion is incremental and cached, so each call parses only new log lines. window (days, up to 365) widens the view; day, month, index and trails read the rollups and trails; host reads one domain and by_host splits the traffic by domain. A caller confined to some domains sees only its own domains' traffic and is refused the rollups, index and trails, which cover the whole instance. The export and its fields are described in the statistics briefing.

Notes

  • Browsing analytics complement the audit trail, which records material actions (auth, edits, deletes) rather than browsing
  • On a site with no auth store, the visitor key is salted from a dedicated random salt, so keys stay non-reversible
  • Successful static-asset serves handled directly by the web server are only visible to the fallback/diagnostics tier