Skip to content
Merged

ui #243

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@hookform/resolvers": "^3",
"@microsoft/clarity": "^1.0.2",
"@monaco-editor/react": "^4.7.0",
"@peculiar/x509": "^2.0.0",
"@radix-ui/react-accordion": "^1.2.12",
Expand Down
20 changes: 20 additions & 0 deletions apps/web/src/components/clarity-analytics.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"use client"

import { useEffect } from "react"

// Microsoft Clarity heatmaps + session replays. No-op unless
// NEXT_PUBLIC_CLARITY_PROJECT_ID is set (so it stays off in local dev),
// matching how Vercel Analytics only reports in production.
// Data lives in clarity.microsoft.com — nothing touches our backend.
let initialized = false // ponytail: module guard so StrictMode/remounts can't double-inject the script

export function ClarityAnalytics() {
useEffect(() => {
const projectId = process.env.NEXT_PUBLIC_CLARITY_PROJECT_ID
if (!projectId || initialized) return
initialized = true
import("@microsoft/clarity").then((m) => m.default.init(projectId))
}, [])

return null
}
7 changes: 7 additions & 0 deletions apps/web/src/components/client-shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const ClientSpeedInsights = dynamic(
() => import('@vercel/speed-insights/next').then((m) => m.SpeedInsights),
{ ssr: false }
)
const ClientClarity = dynamic(
() => import('@/components/clarity-analytics').then((m) => m.ClarityAnalytics),
{ ssr: false }
)
const ClientToaster = dynamic(
() => import('@/components/branded-toaster').then((m) => m.BrandedToaster),
{ ssr: false }
Expand Down Expand Up @@ -47,6 +51,9 @@ export function ClientShell({ children }: Props) {
<Suspense fallback={null}>
<ClientSpeedInsights />
</Suspense>
<Suspense fallback={null}>
<ClientClarity />
</Suspense>
<Suspense fallback={null}>
<ClientToaster />
</Suspense>
Expand Down