aboutsummaryrefslogtreecommitdiff
path: root/apps/web/app/providers.tsx
blob: 13e41647fdefa10e98f5b82574eba4d42ce0fae7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// app/providers.tsx
"use client";
import posthog from "posthog-js";
import { PostHogProvider } from "posthog-js/react";

if (typeof window !== "undefined") {
	posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
		api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST,
		person_profiles: "identified_only",
		capture_pageview: false, // Disable automatic pageview capture, as we capture manually
	});
}

export function PHProvider({ children }: { children: React.ReactNode }) {
	return <PostHogProvider client={posthog}>{children}</PostHogProvider>;
}