mirror of
https://github.com/Xevion/xevion.dev.git
synced 2026-01-31 08:26:41 -06:00
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:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user