feat(analytics): self-hosted openpanel with a typed event catalogue
Replaces Vercel Analytics with OpenPanel, driven entirely by env vars so the whole layer is inert until NEXT_PUBLIC_OPENPANEL_CLIENT_ID is set. Zero initial load cost. next/script emits a rel=preload even on lazyOnload, which pulls the sdk during the first paint, so the component skips it: it inlines the 416 byte official stub (window.op queues calls immediately) and appends the real script itself on window load plus requestIdleCallback. The built html carries no preload and no script src for the analytics host. Events live in one typed catalogue (lib/analytics/events.ts) and track() is keyed to it, so a wrong name or payload is a type error rather than a silent bad row. Emitters sit in the hooks that already own the behaviour instead of being sprinkled through components: - useShowState covers every favourite and watchlist toggle - useInfiniteList covers pagination for all six lists - useTorrents covers all three providers - Preview, Person and useSearch use a shared useTrackOnce hook Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
0186c793f2
commit
d67a0d4df6
26 files changed
+504
-89
No files matched your search
+1
-1
@@ -25,6 +25,7 @@
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@openpanel/web": "^1.4.1",
|
||||
"@radix-ui/react-dialog": "^1.1.1",
|
||||
"@radix-ui/react-dropdown-menu": "^2.1.2",
|
||||
"@radix-ui/react-tabs": "^1.0.4",
|
||||
@@ -33,7 +34,6 @@
|
||||
"@tanstack/react-query-next-experimental": "^5.59.16",
|
||||
"@types/cheerio": "^0.22.35",
|
||||
"@upstash/redis": "^1.38.2",
|
||||
"@vercel/analytics": "^2.0.1",
|
||||
"@vidstack/react": "^1.12.13",
|
||||
"axios": "^1.7.7",
|
||||
"axios-cookiejar-support": "^5.0.3",
|
||||
|
||||
Reference in new issue
Block a user