From 0ad9b7e233543011dd07e09d62e4de99c2f27a54 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Tue, 17 Sep 2024 13:05:56 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=88(frontend)=20limit=20event=20tracki?= =?UTF-8?q?ng=20to=20stay=20within=20free=20tier=20limits?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Optimize event tracking to be frugal and reduce event volume, even though filtering can be done later if needed. --- src/frontend/src/App.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/frontend/src/App.tsx b/src/frontend/src/App.tsx index d5932a5d..49529926 100644 --- a/src/frontend/src/App.tsx +++ b/src/frontend/src/App.tsx @@ -19,14 +19,18 @@ function App() { const { i18n } = useTranslation() useLang(i18n.language) - posthog.init('phc_RPYko028Oqtj0c9exLIWwrlrjLxSdxT0ntW0Lam4iom', { - api_host: 'https://eu.i.posthog.com', - person_profiles: 'always', - }) - const isProduction = import.meta.env.PROD silenceLiveKitLogs(isProduction) + // We're on a free tier, so we need to limit the number of events we send to PostHog. + // Be frugal with event tracking, even though we could filter them out later if necessary. + if (isProduction) { + posthog.init('phc_RPYko028Oqtj0c9exLIWwrlrjLxSdxT0ntW0Lam4iom', { + api_host: 'https://eu.i.posthog.com', + person_profiles: 'always', + }) + } + return (