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

+9
View File
@@ -72,5 +72,14 @@
</p>
</section>
<section class="mu-credit-section">
<h2><span data-i18n="credits.analyticsTitle">สถิติ — แนวคิดจาก Umami</span></h2>
<p class="src"><span data-i18n="credits.src">แหล่งที่มา:</span> <a href="https://github.com/umami-software/umami" rel="noopener">github.com/umami-software/umami</a> · <span data-i18n="credits.lic">ใบอนุญาต:</span> <a href="https://github.com/umami-software/umami/blob/master/LICENSE" rel="noopener">MIT License</a></p>
<ul>
<li><span data-i18n="credits.analyticsBody">ระบบสถิติของเว็บนี้เขียนเองใน</span> <code>ui/analytics.js</code> <span data-i18n="credits.analyticsBody2">(ไม่มี dependency) — ยืมเฉพาะแนวคิด privacy-first และรูปแบบ payload ของ Umami (/api/send) ไม่ได้คัดลอกโค้ดของ Umami มาใช้</span></li>
<li data-i18n="credits.analyticsLocal">ข้อมูลสถิติเก็บในเบราว์เซอร์ของผู้ใช้เท่านั้น (localStorage) — ดู/ล้างได้ที่หน้า “สถิติ”</li>
</ul>
</section>
</div>
</main>