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:
1 parent
5381e0690a
commit
2504c39305
11 files changed
+850
-13
No files matched your search
+18
-6
@@ -12,8 +12,8 @@
|
||||
<link href="./_shared.css" rel="stylesheet">
|
||||
<link href="./vendor/leaflet/leaflet.css" rel="stylesheet">
|
||||
<link href="./map.css" rel="stylesheet">
|
||||
<meta name="app-version" content="2026.09.27.104">
|
||||
<link rel="icon" type="image/png" href="../.image/icons/minibus-512x512.png?v=2026.09.27.104">
|
||||
<meta name="app-version" content="2026.09.27.105">
|
||||
<link rel="icon" type="image/png" href="../.image/icons/minibus-512x512.png?v=2026.09.27.105">
|
||||
<style>
|
||||
.mu-card.empty { width: 100%; padding: 16px; text-align: center; color: #6f7b95; background: #fff7fb; border: 1px dashed #f4c7df; }
|
||||
a.mu-card { text-decoration: none; color: inherit; display: block; }
|
||||
@@ -337,12 +337,23 @@
|
||||
</style>
|
||||
<link rel="manifest" href="./manifest.json">
|
||||
<meta name="theme-color" content="#7a4cc0">
|
||||
<!-- ============================================================
|
||||
สถิติ (Analytics) — ค่าเริ่มต้น: เก็บในเครื่องเท่านั้น (ไม่ส่งที่ไหน)
|
||||
ต้องการส่งเข้า Umami ของตัวเอง/Umami Cloud → ใส่ค่า 2 ตัวนี้:
|
||||
endpoint: "https://umami.example.com" (โดเมน Umami ไม่ต้องมี /api/send)
|
||||
siteId: "xxxxxxxx-xxxx-... (Website ID ใน Umami)"
|
||||
payload ตรงสเปก Umami /api/send (type=event) · ไม่มีคุกกี้/ไม่มี UA/IP
|
||||
============================================================ -->
|
||||
<script>
|
||||
window.AT_ANALYTICS = { endpoint: '', siteId: '' };
|
||||
</script>
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
||||
<link rel="apple-touch-icon" href="../.image/icons/minibus-192x192.png?v=2026.09.27.104">
|
||||
<link rel="apple-touch-icon" href="../.image/icons/minibus-192x192.png?v=2026.09.27.105">
|
||||
<script src="./imageurl.js" defer></script>
|
||||
<script src="./pwa.js" defer></script>
|
||||
<script src="./i18n.js" defer></script>
|
||||
<script src="./analytics.js" defer></script>
|
||||
<script src="./popular.js" defer></script>
|
||||
<script src="./visitors.js" defer></script>
|
||||
<script src="./vendor/leaflet/leaflet.js" defer></script>
|
||||
@@ -445,7 +456,7 @@
|
||||
<header class="mu-topbar">
|
||||
<div class="mu-container mu-topbar-inner">
|
||||
<a class="mu-brand" href="#/" aria-label="Atroute — หน้าแรก" data-i18n-attr="aria-label:aria.brandHome">
|
||||
<img class="mu-logo-img" src="../.image/icons/minibus-512x512.png?v=2026.09.27.104" alt="Atroute logo" width="44" height="44" decoding="async">
|
||||
<img class="mu-logo-img" src="../.image/icons/minibus-512x512.png?v=2026.09.27.105" alt="Atroute logo" width="44" height="44" decoding="async">
|
||||
<span>
|
||||
<span class="mu-brand-title">Atroute</span>
|
||||
<span class="mu-brand-subtitle" data-i18n="brand.subtitle">สถานีขนส่งผู้โดยสารจังหวัดอ่างทอง</span>
|
||||
@@ -488,7 +499,7 @@
|
||||
<div class="mu-footer-grid">
|
||||
<div class="mu-footer-brand">
|
||||
<div class="mu-footer-brand-row">
|
||||
<img src="../.image/icons/minibus-512x512.png?v=2026.09.27.104" alt="Atroute">
|
||||
<img src="../.image/icons/minibus-512x512.png?v=2026.09.27.105" alt="Atroute">
|
||||
<div>
|
||||
<strong>Atroute</strong>
|
||||
<span data-i18n="brand.subtitle">สถานีขนส่งผู้โดยสารจังหวัดอ่างทอง</span>
|
||||
@@ -504,7 +515,8 @@
|
||||
<li><a href="#/routes" data-i18n="nav.routes">รายละเอียดสายรถ</a></li>
|
||||
<li><a href="#/about" data-i18n="nav.about">เกี่ยวกับเรา</a></li>
|
||||
<li><a href="#/blog" data-i18n="nav.blog">บ่นไปเรื่อย</a></li>
|
||||
<li><a href="#/credits" data-i18n="nav.credits">เครดิต</a></li></ul>
|
||||
<li><a href="#/credits" data-i18n="nav.credits">เครดิต</a></li>
|
||||
<li><a href="#/stats" data-i18n="nav.stats">สถิติ</a></li></ul>
|
||||
</div>
|
||||
<div class="mu-footer-col">
|
||||
<h4 data-i18n="footer.popular">สายที่เปิดดูบ่อย</h4>
|
||||
|
||||
Reference in new issue
Block a user