analytics: privacy-first search stats (Umami-style), #/stats page

- ui/analytics.js: cookie-less local-first tracker (localStorage), DNT/GPC
  honoured, opt-out switch, term sanitiser (email/@handle/long digits stripped),
  900ms debounce, caps 300 terms / 200 views / 120 days
- optional Umami-compatible beacon (window.AT_ANALYTICS endpoint+siteId),
  disabled by default: no third-party requests unless the owner configures it
- #/stats view: KPIs, 14-day CSS bar chart, top terms, top route/stop pages,
  no-result terms, privacy panel, JSON export, clear, opt-out
- hooks: busStop search apply(), stopDetail route filter, hashchange pageviews
- i18n th/en (395 keys each), credits section, sw.js precache + VERSION 2026.09.27.105
This commit is contained in:
Bkk1234 committed 2026-11-03 00:07:57 +07:00
1 parent 5381e0690a
commit 2504c39305
11 files changed
+850 -13

No files matched your search

+4 -1
View File
@@ -13,7 +13,7 @@
- ขั้นตอนอัปเดต: ดู AGENTS.md หัวข้อ PWA
============================================================ */
const VERSION = "2026.09.27.104"; // ← bump ทุกครั้งที่แก้ SW เอง
const VERSION = "2026.09.27.105"; // ← bump ทุกครั้งที่แก้ SW เอง
const CACHE = `at-transit-${VERSION}`;
const PRECACHE = [
@@ -32,6 +32,7 @@ const PRECACHE = [
"./i18n.js",
"./popular.js",
"./visitors.js",
"./analytics.js",
"./router.js",
"./motion.js",
"./partials/home.html",
@@ -48,6 +49,8 @@ const PRECACHE = [
"./partials/about.init.js",
"./partials/blog.html",
"./partials/blog.init.js",
"./partials/stats.html",
"./partials/stats.init.js",
"./partials/busDetail.init.js",
"./partials/checkSchedule.init.js",
"./partials/schedules.js",