Changeset 1794fac in Klonkt for src/config/database.js


Ignore:
Timestamp:
06/19/2026 04:07:24 AM (3 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
6be57b4
Parents:
37edecd
Message:

Pro stats (premium feature #5): referrers + period selector + all-time

Extension of the cookie-free StatsService.

  • DB: stat_referrer (site_id, host, count).
  • StatsService: recordPageview now also counts the external referrer host (Referer header; empty/own-site/invalid skipped, www- normalised). getStats(days) clamps to 7/14/30/90 + returns top-10 referrers (instance-wide) + all-time (pageviews, visitor days).
  • admin-stats route: ?days=7|14|30|90.
  • admin-stats view: period buttons, dynamic labels, Sources section, all-time row.

node --check passed.

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/config/database.js

    r37edecd r1794fac  
    146146    );
    147147    CREATE INDEX IF NOT EXISTS idx_stat_visitor_day ON stat_visitor_day(site_id, day);
     148    CREATE TABLE IF NOT EXISTS stat_referrer (
     149      site_id TEXT NOT NULL,
     150      host TEXT NOT NULL,
     151      count INTEGER NOT NULL DEFAULT 0,
     152      PRIMARY KEY (site_id, host)
     153    );
    148154  `);
    149155
Note: See TracChangeset for help on using the changeset viewer.