From 18d9acfc86227f04efa79a11bd8599e7452c2ec4 Mon Sep 17 00:00:00 2001 From: openhands Date: Tue, 12 Nov 2024 17:36:25 +0000 Subject: [PATCH] Fix issue #4939: Move PostHog client key to `config.json` --- frontend/public/config.json | 3 ++- frontend/src/entry.client.tsx | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/frontend/public/config.json b/frontend/public/config.json index 49dd5e4362..7dbb7e1d96 100644 --- a/frontend/public/config.json +++ b/frontend/public/config.json @@ -1,4 +1,5 @@ { "APP_MODE": "oss", - "GITHUB_CLIENT_ID": "" + "GITHUB_CLIENT_ID": "", + "POSTHOG_CLIENT_KEY": "phc_3ESMmY9SgqEAGBB6sMGK5ayYHkeUuknH2vP6FmWH9RA" } diff --git a/frontend/src/entry.client.tsx b/frontend/src/entry.client.tsx index 4fe347f703..96e85e9c63 100644 --- a/frontend/src/entry.client.tsx +++ b/frontend/src/entry.client.tsx @@ -15,10 +15,14 @@ import store from "./store"; function PosthogInit() { React.useEffect(() => { - posthog.init("phc_3ESMmY9SgqEAGBB6sMGK5ayYHkeUuknH2vP6FmWH9RA", { - api_host: "https://us.i.posthog.com", - person_profiles: "identified_only", - }); + fetch("/config.json") + .then((response) => response.json()) + .then((config) => { + posthog.init(config.POSTHOG_CLIENT_KEY, { + api_host: "https://us.i.posthog.com", + person_profiles: "identified_only", + }); + }); }, []); return null;