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
@@ -159,6 +159,15 @@
|
||||
var searching = !!f.value;
|
||||
var limit = (searching || state.showAll) ? filtered.length : PREVIEW_LIMIT;
|
||||
|
||||
/* สถิติคำค้น (เฉพาะตอนมีคำจริง · Analytics ทำ debounce 900ms ให้เอง) */
|
||||
if (searching && window.Analytics) {
|
||||
window.Analytics.search({
|
||||
q: f.value,
|
||||
scope: state.mode === MODE_CODE ? 'code' : 'place',
|
||||
results: filtered.length
|
||||
});
|
||||
}
|
||||
|
||||
var cards = [].filter.call(host.children, function (el) { return el.tagName === 'LI' && el.hasAttribute('data-idx'); });
|
||||
var shown = 0;
|
||||
Array.prototype.forEach.call(cards, function (li) {
|
||||
|
||||
Reference in new issue
Block a user