diff --git a/.clj-kondo/hooks/metabase/models/setting.clj b/.clj-kondo/hooks/metabase/models/setting.clj index b32162995bb90916ff18179ae4c5d0d676ce0e87..32eb3266aec7b9205773e86be73f68adffab24dc 100644 --- a/.clj-kondo/hooks/metabase/models/setting.clj +++ b/.clj-kondo/hooks/metabase/models/setting.clj @@ -38,8 +38,6 @@ engines enum-cardinality-threshold follow-up-email-sent - ga-code - ga-enabled google-auth-auto-create-accounts-domain google-auth-client-id google-auth-configured diff --git a/frontend/src/metabase-types/api/mocks/settings.ts b/frontend/src/metabase-types/api/mocks/settings.ts index dd522ee268e77381fda5b416416bb94fcffff886..d36ea4a9cfc66b803f8fcc817c3e1a4b2ca85025 100644 --- a/frontend/src/metabase-types/api/mocks/settings.ts +++ b/frontend/src/metabase-types/api/mocks/settings.ts @@ -178,7 +178,6 @@ export const createMockSettings = ( "has-user-setup": true, "hide-embed-branding?": true, "show-static-embed-terms": true, - "ga-enabled": false, "google-auth-auto-create-accounts-domain": null, "google-auth-client-id": null, "google-auth-configured": false, diff --git a/frontend/src/metabase-types/api/settings.ts b/frontend/src/metabase-types/api/settings.ts index 1e4df5d62dbe8ca892a17d5fd858e7e4de2a6fa8..12a92c97903c25ef887ec0ad8ef569a2fb60b7e2 100644 --- a/frontend/src/metabase-types/api/settings.ts +++ b/frontend/src/metabase-types/api/settings.ts @@ -281,7 +281,6 @@ interface PublicSettings { "enable-enhancements?": boolean; "enable-password-login": boolean; engines: Record<string, Engine>; - "ga-enabled": boolean; "google-auth-client-id": string | null; "google-auth-enabled": boolean; "has-user-setup": boolean; diff --git a/frontend/src/metabase/lib/analytics.js b/frontend/src/metabase/lib/analytics.js index 315ac94afa282cfd65632a397935b37a331df850..035bd2d01c2551a5f8fe45a3cc0510a38cd49c68 100644 --- a/frontend/src/metabase/lib/analytics.js +++ b/frontend/src/metabase/lib/analytics.js @@ -5,15 +5,9 @@ import Settings from "metabase/lib/settings"; import { getUserId } from "metabase/selectors/user"; export const createTracker = store => { - if (Settings.googleAnalyticsEnabled()) { - createGoogleAnalyticsTracker(); - } - if (Settings.snowplowEnabled()) { createSnowplowTracker(store); - } - if (Settings.googleAnalyticsEnabled() || Settings.snowplowEnabled()) { document.body.addEventListener("click", handleStructEventClick, true); } }; @@ -23,10 +17,6 @@ export const trackPageView = url => { return; } - if (Settings.googleAnalyticsEnabled()) { - trackGoogleAnalyticsPageView(getSanitizedUrl(url)); - } - if (Settings.snowplowEnabled()) { trackSnowplowPageView(getSanitizedUrl(url)); } @@ -39,10 +29,6 @@ export const trackStructEvent = (category, action, label, value) => { if (!category || !label || !Settings.trackingEnabled()) { return; } - - if (Settings.googleAnalyticsEnabled()) { - trackGoogleAnalyticsStructEvent(category, action, label, value); - } }; export const trackSchemaEvent = (schema, version, data) => { @@ -66,28 +52,6 @@ export const trackSchemaEvent = (schema, version, data) => { } }; -const createGoogleAnalyticsTracker = () => { - const code = Settings.get("ga-code"); - window.ga?.("create", code, "auto"); - - Settings.on("anon-tracking-enabled", enabled => { - window[`ga-disable-${code}`] = enabled ? null : true; - }); -}; - -const trackGoogleAnalyticsPageView = url => { - const version = Settings.get("version", {}); - window.ga?.("set", "dimension1", version.tag); - window.ga?.("set", "page", url); - window.ga?.("send", "pageview", url); -}; - -const trackGoogleAnalyticsStructEvent = (category, action, label, value) => { - const version = Settings.get("version", {}); - window.ga?.("set", "dimension1", version.tag); - window.ga?.("send", "event", category, action, label, value); -}; - const createSnowplowTracker = store => { Snowplow.newTracker("sp", Settings.snowplowUrl(), { appId: "metabase", diff --git a/frontend/src/metabase/lib/settings.ts b/frontend/src/metabase/lib/settings.ts index 4f4a41104b09cdccbeb514b6e372b4a532ed746f..697118496034f7cfc412b4e5d6c729def7e564b6 100644 --- a/frontend/src/metabase/lib/settings.ts +++ b/frontend/src/metabase/lib/settings.ts @@ -220,13 +220,6 @@ class MetabaseSettings { return !!(this.get("uploads-enabled") && this.get("uploads-database-id")); } - /** - * @deprecated use getSetting(state, "ga-enabled") - */ - googleAnalyticsEnabled() { - return this.get("ga-enabled") || false; - } - /** * @deprecated use getSetting(state, "snowplow-enabled") */ diff --git a/src/metabase/public_settings.clj b/src/metabase/public_settings.clj index f1ac3c10753680b0b74bec4cf4662ed6d42e2890..0cab2bb3d0544d6e06681d5beba58083137eb0c9 100644 --- a/src/metabase/public_settings.clj +++ b/src/metabase/public_settings.clj @@ -214,21 +214,6 @@ :visibility :public :audit :getter) -(defsetting ga-code - (deferred-tru "Google Analytics tracking code.") - :default "UA-60817802-1" - :visibility :public - :doc false) - -(defsetting ga-enabled - (deferred-tru "Boolean indicating whether analytics data should be sent to Google Analytics on the frontend") - :type :boolean - :setter :none - :getter (fn [] (and config/is-prod? (anon-tracking-enabled))) - :visibility :public - :audit :never - :doc false) - (defsetting map-tile-server-url (deferred-tru "The map tile server URL template used in map visualizations, for example from OpenStreetMaps or MapBox.") :default "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"