diff --git a/apps/readest-app/src/context/PHContext.tsx b/apps/readest-app/src/context/PHContext.tsx index 97222701..058500b2 100644 --- a/apps/readest-app/src/context/PHContext.tsx +++ b/apps/readest-app/src/context/PHContext.tsx @@ -19,12 +19,11 @@ const posthogKey = atob(process.env['NEXT_PUBLIC_DEFAULT_POSTHOG_KEY_BASE64']!); if (typeof window !== 'undefined' && process.env['NODE_ENV'] === 'production' && posthogKey) { - posthog.init(posthogKey, { - api_host: posthogUrl, - person_profiles: 'always', - }); - if (shouldDisablePostHog()) { - posthog.opt_out_capturing(); + if (!shouldDisablePostHog()) { + posthog.init(posthogKey, { + api_host: posthogUrl, + person_profiles: 'always', + }); } } export const CSPostHogProvider = ({ children }: { children: ReactNode }) => {