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
15 lines
536 B
TypeScript
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>
|
|
);
|
|
}
|