feat: integrate PostHog for analytics tracking and add PostHogProvider component

This commit is contained in:
2025-06-20 03:07:06 +00:00
committed by GitHub
parent 6d6b1baa62
commit e4b239e230
8 changed files with 152 additions and 14 deletions

11
lib/posthog.ts Normal file
View File

@@ -0,0 +1,11 @@
import { PostHog } from "posthog-node"
export default function PostHogClient() {
const posthogClient = new PostHog(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
capture_pageview: 'history_change',
flushAt: 1,
flushInterval: 0,
})
return posthogClient
}