Changeset 1794fac in Klonkt for src/routes/admin-stats.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/routes/admin-stats.js

    r37edecd r1794fac  
    3131    } catch { linkClicks = []; }
    3232  }
     33  const days = [7, 14, 30, 90].includes(parseInt(req.query.days, 10)) ? parseInt(req.query.days, 10) : 14;
    3334  renderPage(req, res, 'pages/admin-stats', {
    3435    pageTitle: 'Statistieken',
    3536    bodyClass: 'on-admin',
    36     stats: getStats(14),
     37    stats: getStats(days),
    3738    linkClicks,
    3839  });
Note: See TracChangeset for help on using the changeset viewer.