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

+5
View File
@@ -333,6 +333,11 @@
if (ok) shown++;
});
setCount(shown, items.length);
/* สถิติคำค้นในหน้ารายละเอียดป้าย (debounce อยู่ใน Analytics) */
if (kw.length >= 2 && window.Analytics) {
window.Analytics.search({ q: kw, scope: 'stop', results: shown });
}
}
function setupFilter() {
var input = $('mu-route-filter');