From 399adf2276e01f35324d06e73e6d08543728c1d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl?= Date: Mon, 3 Aug 2026 15:33:55 +0200 Subject: [PATCH] feat(analytics): disable analytics unless credentials are configured Removes the onboarding opt-in screen, the Analytics settings entry and the unused Posthog and Sentry SDKs. --- plugins/src/main/kotlin/ModulesConfig.kt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/src/main/kotlin/ModulesConfig.kt b/plugins/src/main/kotlin/ModulesConfig.kt index b5360b42ca..02345c7cdc 100644 --- a/plugins/src/main/kotlin/ModulesConfig.kt +++ b/plugins/src/main/kotlin/ModulesConfig.kt @@ -16,7 +16,12 @@ object ModulesConfig { includeUnifiedPush = BuildTimeConfig.PUSH_CONFIG_INCLUDE_UNIFIED_PUSH, ) - val analyticsConfig: AnalyticsConfig = if (isEnterpriseBuild) { + // Analytics is enabled only when credentials are actually configured in BuildTimeConfig. + // Upstream applies this rule to enterprise builds only and hardcodes both providers on for + // FOSS builds; HealthChat ships no Posthog or Sentry credentials, so that hardcoding meant + // shipping both SDKs, prompting every new user with the analytics opt-in screen during the + // FTUE, and showing an Analytics settings entry — all while collecting nothing. + val analyticsConfig: AnalyticsConfig = run { // Is Posthog configuration available? val withPosthog = BuildTimeConfig.SERVICES_POSTHOG_APIKEY.isNullOrEmpty().not() && BuildTimeConfig.SERVICES_POSTHOG_HOST.isNullOrEmpty().not() @@ -32,11 +37,5 @@ object ModulesConfig { println("Analytics disabled") AnalyticsConfig.Disabled } - } else { - println("Analytics enabled with Posthog and Sentry") - AnalyticsConfig.Enabled( - withPosthog = true, - withSentry = true, - ) } }