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:
Zaldimmar 2026-10-04 21:44:25 -05:00
parent b8012c75e9
commit 636388730f
6 changed files with 254 additions and 1 deletions

View file

@ -145,6 +145,33 @@ export const siteSettings = {
},
],
},
{
legend: "Reports",
fields: [
{
path: "report_daily",
label: "Daily analytics report",
widget: "select",
options: [
["on", "On"],
["off", "Off"],
],
blankLabel: "Default: off",
help: "Yesterday's visitors, pageviews and top pages from Plausible, posted to Discord each morning. Needs PLAUSIBLE_API_KEY and DISCORD_WEBHOOK_URL on the server (server/src/analyticsReport.js).",
},
{
path: "report_weekly",
label: "Weekly analytics report",
widget: "select",
options: [
["on", "On"],
["off", "Off"],
],
blankLabel: "Default: off",
help: "The last 7 days, with the change from the week before, posted to Discord each Monday morning.",
},
],
},
{
legend: "Notices",
fields: [