Plausible analytics reports to Discord (migration 065)
Daily (yesterday) and weekly (Mondays, last 7 days vs the 7 before) summaries: visitors, pageviews, bounce rate, visit length, top pages and sources. Each has its own switch in Site settings > Reports; off until PLAUSIBLE_API_KEY and DISCORD_WEBHOOK_URL are set. Sent at 8:00 REPORT_TZ (default America/Chicago); analytics_reports keeps one a day. node src/analyticsReport.js daily|weekly sends one by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b8012c75e9
commit
636388730f
6 changed files with 254 additions and 1 deletions
|
|
@ -45,6 +45,7 @@ import { UPLOADS_DIR, writeMissingThumbs } from "./media.js";
|
|||
import { logSafe, startSessionSweeper } from "./auth.js";
|
||||
import { syncDescriptorsWithSchema } from "./admin-schema-sync.js";
|
||||
import { startGroupSync } from "./accessGroups.js";
|
||||
import { startAnalyticsReports } from "./analyticsReport.js";
|
||||
import { ENTITIES } from "./admin-schema.js";
|
||||
|
||||
const HOST = process.env.HOST ?? "127.0.0.1";
|
||||
|
|
@ -241,6 +242,7 @@ app.route("/", pages);
|
|||
startSessionSweeper(db);
|
||||
startGroupSync(db);
|
||||
startClipWorker(db);
|
||||
startAnalyticsReports(db);
|
||||
console.log(`clips ${CLIPS_DIR}`);
|
||||
|
||||
app.notFound((c) => c.json({ error: "Not found" }, 404));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue