1
0
Fork 0
polaris-task-force/src/app/login/layout.tsx
Z8MB1E 268d4bb117 feat(analytics): add first-party analytics collector, SDK, rollups, and admin dashboard
Phase 1 of replacing Microsoft Clarity with first-party usage analytics:
- Plain Postgres tables via shared DDL module (src/lib/analytics/schema.ts)
  executed by both the add_analytics_tables migration and the test bootstrap;
  test-db.ts drops them around drizzle push (composite-PK introspector bug)
- /api/collect beacon collector with IP/UA enrichment, retroactive login
  attribution, bot blocklist, per-IP rate limiting, strict validation
- Client SDK (src/lib/client-analytics): SPA pageviews, clicks, scroll depth,
  focus, data-track visibility, heartbeats; NEXT_PUBLIC_ANALYTICS_DEV=1 dev
  gate with console mirror; mounted beside Clarity in the two frontend layouts
- Hourly rollup + daily retention bins (payload analytics-rollup/-purge)
- Chronicle read progress/completion, wiki new-clicked/created, minigame
  route mapping custom events
- admin:analytics:manage permission (+ roles enum migration) and the
  /admin/analytics Payload view with six recharts-backed report panels
2026-10-14 12:12:53 -04:00

15 lines
536 B
TypeScript

import "@/app/(frontend)/styles.css";
import { ClarityAnalytics } from "@/components/frontend/analytics/ClarityAnalytics";
import { AnalyticsTracker } from "@/lib/client-analytics/AnalyticsTracker";
export default function LoginLayout(props: { children: React.ReactNode }) {
return (
<html lang="en" className="bg-black leading-8 antialiased h-full dark">
<body className="h-full font-sans m-0 text-white">
{props.children}
<ClarityAnalytics />
<AnalyticsTracker />
</body>
</html>
);
}