Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

fix: hide empty Usage tracking section on Cloud Starter (#74262)

Mahatthana (Kelvin) Nomsawadi1a56a1c841ab
diff --git a/frontend/src/metabase/admin/settings/components/SettingsPages/GeneralSettingsPage.tsx b/frontend/src/metabase/admin/settings/components/SettingsPages/GeneralSettingsPage.tsx
index 51eb5c1f468..fbc6c63eaca 100644
--- a/frontend/src/metabase/admin/settings/components/SettingsPages/GeneralSettingsPage.tsx
+++ b/frontend/src/metabase/admin/settings/components/SettingsPages/GeneralSettingsPage.tsx
@@ -87,11 +87,14 @@ export function GeneralSettingsPage() {
/>
</SettingsSection>
- <SettingsSection title={t`Usage tracking`}>
- {enableAnonymousTracking && <AnonymousTrackingInput />}
-
- {hasAuditAppFeature && <CollectUserDataInput />}
- </SettingsSection>
+ {/* On starter plan, both conditions are `false` */}
+ {(enableAnonymousTracking || hasAuditAppFeature) && (
+ <SettingsSection title={t`Usage tracking`}>
+ {enableAnonymousTracking && <AnonymousTrackingInput />}
+
+ {hasAuditAppFeature && <CollectUserDataInput />}
+ </SettingsSection>
+ )}
<UpsellDevInstances location="settings-general" />
</SettingsPageWrapper>
diff --git a/frontend/src/metabase/admin/settings/components/SettingsPages/GeneralSettingsPage.unit.spec.tsx b/frontend/src/metabase/admin/settings/components/SettingsPages/GeneralSettingsPage.unit.spec.tsx
index 554459d92c5..5c0b77007a4 100644
--- a/frontend/src/metabase/admin/settings/components/SettingsPages/GeneralSettingsPage.unit.spec.tsx
+++ b/frontend/src/metabase/admin/settings/components/SettingsPages/GeneralSettingsPage.unit.spec.tsx
@@ -199,4 +199,30 @@ describe("GeneralSettingsPage", () => {
screen.queryByText("Collect user data to display in usage analytics"),
).not.toBeInTheDocument();
});
+
+ describe("Usage tracking section visibility", () => {
+ it("should hide the Usage tracking section on Starter Cloud (hosting without audit_app)", async () => {
+ await setup({ isCloudPlan: true, hasAuditApp: false });
+
+ expect(screen.queryByText("Usage tracking")).not.toBeInTheDocument();
+ });
+
+ it("should show the Usage tracking section on Pro Cloud (hosting with audit_app)", async () => {
+ await setup({ isCloudPlan: true, hasAuditApp: true });
+
+ expect(screen.getByText("Usage tracking")).toBeInTheDocument();
+ });
+
+ it("should show the Usage tracking section on self-hosted OSS (no hosting, no audit_app)", async () => {
+ await setup({ isCloudPlan: false, hasAuditApp: false });
+
+ expect(screen.getByText("Usage tracking")).toBeInTheDocument();
+ });
+
+ it("should show the Usage tracking section on self-hosted EE (no hosting, audit_app)", async () => {
+ await setup({ isCloudPlan: false, hasAuditApp: true });
+
+ expect(screen.getByText("Usage tracking")).toBeInTheDocument();
+ });
+ });
});