From 21bf378a3184e0dd4d7bccb67b01f3e803e7d57b Mon Sep 17 00:00:00 2001 From: Tarrence van As Date: Wed, 11 Dec 2024 17:17:33 -0500 Subject: [PATCH] Enable posthog again (#1146) --- packages/keychain/src/pages/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/keychain/src/pages/index.tsx b/packages/keychain/src/pages/index.tsx index 02ffa47cb..c2106386d 100644 --- a/packages/keychain/src/pages/index.tsx +++ b/packages/keychain/src/pages/index.tsx @@ -18,7 +18,10 @@ function Home() { const posthog = usePostHog(); useEffect(() => { - if (context?.origin && !context.origin.includes("localhost")) { + if ( + typeof window !== "undefined" && + !window.location.hostname.includes("localhost") + ) { posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, { api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST, person_profiles: "always",