User feedback + expanded privacy-respecting admin stats

Feedback:
- feedback table; POST /api/feedback (anonymous-ok, optional category/email,
  honeypot + per-day flood cap) stores + emails the admin; GET /api/admin/feedback.
- Shared feedback store + FeedbackModal; a speech-bubble opens it from the desktop
  header, the mobile top bar (logo moves left), the footer, and /account. Feedback
  section in /admin.

Stats (additive, same privacy model — no IP/UA/referrer/raw terms):
- Event vocab: summary_viewed (fired on /a load), full_story (card → source),
  not_today/less_like_this/hide_topic, replace_used/replace_none, paywall_replace,
  paywalled_source_open. Card title/image opens /a (no double-count); history
  records via keepalive so it survives the nav.
- Dashboard: Accounts card (counts only), reading funnel (summary→source rate),
  emotional-mix & friction, paywall, returning-visitor buckets. (Health metrics
  deferred to a future monitoring dashboard.) 131 tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jay
2026-06-05 12:58:49 +00:00
parent cfde4e22db
commit 427210ac3e
16 changed files with 460 additions and 38 deletions
@@ -5,8 +5,8 @@
let { article, onaction, onreplace, ontag, onimageerror, onview, hero = false } = $props();
function opened() {
// Records history; the /a page itself fires the summary_viewed event on load.
onview?.(article);
track('open', article.id);
}
let isSaved = $derived(savedIds.has(article.id));
@@ -47,7 +47,8 @@
let summaryHref = $derived('/a/' + article.id);
function openedSource() {
onview?.(article);
track('open', article.id);
track('full_story', article.id);
if (article.paywalled) track('paywalled_source_open', article.id);
}
function act(kind, value) {