diff --git a/frontend/src/app/_components/providers.tsx b/frontend/src/app/_components/providers.tsx index d1d6e6fd..6065f7c8 100644 --- a/frontend/src/app/_components/providers.tsx +++ b/frontend/src/app/_components/providers.tsx @@ -6,7 +6,9 @@ import { Toaster } from "react-hot-toast" import posthog from "posthog-js" import { PostHogProvider } from 'posthog-js/react' -if (typeof window !== 'undefined') { +const posthog_enabled = process.env.NEXT_PUBLIC_POSTHOG_KEY != null + +if (typeof window !== 'undefined' && posthog_enabled) { posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY || '', { api_host: process.env.NEXT_PUBLIC_POSTHOG_API_HOST || '', ui_host: process.env.NEXT_PUBLIC_POSTHOG_UI_HOST || '',