feat: add PostHog telemetry with type-safe event tracking

Track page views, project interactions, theme changes, external links, PGP actions, and errors. Console logging in dev when PostHog not configured. Requires PUBLIC_POSTHOG_KEY and PUBLIC_POSTHOG_HOST env vars.
This commit is contained in:
2026-01-14 12:25:10 -06:00
parent 08c5dcda3b
commit d360f2284e
16 changed files with 475 additions and 7 deletions
+4
View File
@@ -1,3 +1,5 @@
import { telemetry } from "$lib/telemetry";
class AuthStore {
isAuthenticated = $state(false);
username = $state<string | null>(null);
@@ -17,6 +19,7 @@ class AuthStore {
const data = await response.json();
this.isAuthenticated = true;
this.username = data.username;
telemetry.identifyAdmin(data.username);
return true;
}
@@ -38,6 +41,7 @@ class AuthStore {
} finally {
this.isAuthenticated = false;
this.username = null;
telemetry.reset();
}
}