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, - ) } }