diff --git a/Makefile b/Makefile index 5f6036519b..456821e0e6 100644 --- a/Makefile +++ b/Makefile @@ -48,8 +48,6 @@ deploy-appbundle: $(BUILD_DIR)/external_api.min.js.map \ $(BUILD_DIR)/alwaysontop.min.js \ $(BUILD_DIR)/alwaysontop.min.js.map \ - $(BUILD_DIR)/analytics-ga.min.js \ - $(BUILD_DIR)/analytics-ga.min.js.map \ $(BUILD_DIR)/face-landmarks-worker.min.js \ $(BUILD_DIR)/face-landmarks-worker.min.js.map \ $(BUILD_DIR)/noise-suppressor-worklet.min.js \ diff --git a/config.js b/config.js index e8ff9ed933..bf7189cc64 100644 --- a/config.js +++ b/config.js @@ -1091,9 +1091,6 @@ var config = { // True if the analytics should be disabled // disabled: false, - // The Google Analytics Tracking ID: - // googleAnalyticsTrackingId: 'your-tracking-id-UA-123456-1', - // Matomo configuration: // matomoEndpoint: 'https://your-matomo-endpoint/', // matomoSiteID: '42', @@ -1131,7 +1128,6 @@ var config = { // Array of script URLs to load as lib-jitsi-meet "analytics handlers". // scriptURLs: [ - // "libs/analytics-ga.min.js", // google-analytics // "https://example.com/my-custom-analytics.js", // ], diff --git a/react/features/analytics/functions.ts b/react/features/analytics/functions.ts index 1f7edb6d08..5551103e9f 100644 --- a/react/features/analytics/functions.ts +++ b/react/features/analytics/functions.ts @@ -87,7 +87,6 @@ export async function createHandlers({ getState }: IStore) { amplitudeIncludeUTM, blackListedEvents, scriptURLs, - googleAnalyticsTrackingId, matomoEndpoint, matomoSiteID, whiteListedEvents @@ -98,7 +97,6 @@ export async function createHandlers({ getState }: IStore) { amplitudeIncludeUTM, blackListedEvents, envType: deploymentInfo?.envType || 'dev', - googleAnalyticsTrackingId, matomoEndpoint, matomoSiteID, group, diff --git a/react/features/analytics/handlers/AbstractHandler.ts b/react/features/analytics/handlers/AbstractHandler.ts index 1b884b05be..fb1ca7bfb1 100644 --- a/react/features/analytics/handlers/AbstractHandler.ts +++ b/react/features/analytics/handlers/AbstractHandler.ts @@ -14,7 +14,6 @@ interface IOptions { amplitudeIncludeUTM?: boolean; blackListedEvents?: string[]; envType?: string; - googleAnalyticsTrackingId?: string; group?: string; host?: string; matomoEndpoint?: string; diff --git a/react/features/analytics/handlers/GoogleAnalyticsHandler.ts b/react/features/analytics/handlers/GoogleAnalyticsHandler.ts deleted file mode 100644 index 9845cd6c30..0000000000 --- a/react/features/analytics/handlers/GoogleAnalyticsHandler.ts +++ /dev/null @@ -1,159 +0,0 @@ -/* global ga */ - -import { getJitsiMeetGlobalNS } from '../../base/util/helpers'; - -import AbstractHandler, { IEvent } from './AbstractHandler'; - -/** - * Analytics handler for Google Analytics. - */ -class GoogleAnalyticsHandler extends AbstractHandler { - _userProperties: Object; - _userPropertiesString: string; - - /** - * Creates new instance of the GA analytics handler. - * - * @param {Object} options - The Google Analytics options. - * @param {string} options.googleAnalyticsTrackingId - The GA track id - * required by the GA API. - */ - constructor(options: any) { - super(options); - - this._userProperties = {}; - - if (!options.googleAnalyticsTrackingId) { - throw new Error('Failed to initialize Google Analytics handler, no tracking ID'); - } - - this._enabled = true; - this._initGoogleAnalytics(options); - } - - /** - * Initializes the ga object. - * - * @param {Object} options - The Google Analytics options. - * @param {string} options.googleAnalyticsTrackingId - The GA track id - * required by the GA API. - * @returns {void} - */ - _initGoogleAnalytics(options: any) { - /** - * TODO: Keep this local, there's no need to add it to window. - */ - /* eslint-disable */ // @ts-ignore - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ - // @ts-ignore - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) - })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); - /* eslint-enable */ - // @ts-ignore - ga('create', options.googleAnalyticsTrackingId, 'auto'); - - // @ts-ignore - ga('send', 'pageview'); - } - - /** - * Extracts the integer to use for a Google Analytics event's value field - * from a lib-jitsi-meet analytics event. - * - * @param {Object} event - The lib-jitsi-meet analytics event. - * @returns {number} - The integer to use for the 'value' of a Google - * analytics event, or NaN if the lib-jitsi-meet event doesn't contain a - * suitable value. - * @private - */ - _extractValue(event: IEvent) { - let value: string | number | undefined = event?.attributes?.value; - - // Try to extract an integer from the "value" attribute. - value = Math.round(parseFloat(value ?? '')); - - return value; - } - - /** - * Extracts the string to use for a Google Analytics event's label field - * from a lib-jitsi-meet analytics event. - * - * @param {Object} event - The lib-jitsi-meet analytics event. - * @returns {string} - The string to use for the 'label' of a Google - * analytics event. - * @private - */ - _extractLabel(event: IEvent) { - const { attributes = {} } = event; - const labelsArray - = Object.keys(attributes).map(key => `${key}=${attributes[key]}`); - - labelsArray.push(this._userPropertiesString); - - return labelsArray.join('&'); - } - - /** - * Sets the permanent properties for the current session. - * - * @param {Object} userProps - The permanent portperties. - * @returns {void} - */ - setUserProperties(userProps: any = {}) { - if (!this._enabled) { - return; - } - - // The label field is limited to 500B. We will concatenate all - // attributes of the event, except the user agent because it may be - // lengthy and is probably included from elsewhere. - const filter = [ 'user_agent', 'callstats_name' ]; - - this._userPropertiesString - = Object.keys(userProps) - .filter(key => filter.indexOf(key) === -1) - .map(key => `permanent_${key}=${userProps[key]}`) - .join('&'); - } - - /** - * This is the entry point of the API. The function sends an event to - * google analytics. The format of the event is described in - * analyticsAdapter in lib-jitsi-meet. - * - * @param {Object} event - The event in the format specified by - * lib-jitsi-meet. - * @returns {void} - */ - sendEvent(event: IEvent) { - if (this._shouldIgnore(event)) { - return; - } - - const gaEvent: { - eventAction?: string; - eventCategory: string; - eventLabel: string; - eventValue?: number; - } = { - 'eventCategory': 'jitsi-meet', - 'eventAction': this._extractName(event), - 'eventLabel': this._extractLabel(event) - }; - const value = this._extractValue(event); - - if (!isNaN(value)) { - gaEvent.eventValue = value; - } - - // @ts-ignore - ga('send', 'event', gaEvent); - } - -} - -const globalNS = getJitsiMeetGlobalNS(); - -globalNS.analyticsHandlers = globalNS.analyticsHandlers || []; -globalNS.analyticsHandlers.push(GoogleAnalyticsHandler); diff --git a/react/features/base/conference/functions.ts b/react/features/base/conference/functions.ts index f4757f2b3a..c9ebe544a2 100644 --- a/react/features/base/conference/functions.ts +++ b/react/features/base/conference/functions.ts @@ -237,7 +237,6 @@ export function getConferenceOptions(stateful: IStateful) { if (options.disableThirdPartyRequests) { delete config.analytics?.scriptURLs; delete config.analytics?.amplitudeAPPKey; - delete config.analytics?.googleAnalyticsTrackingId; } return options; diff --git a/react/features/base/config/configType.ts b/react/features/base/config/configType.ts index 6fab85965b..df4929431f 100644 --- a/react/features/base/config/configType.ts +++ b/react/features/base/config/configType.ts @@ -185,7 +185,6 @@ export interface IConfig { amplitudeIncludeUTM?: boolean; blackListedEvents?: string[]; disabled?: boolean; - googleAnalyticsTrackingId?: string; matomoEndpoint?: string; matomoSiteID?: string; obfuscateRoomName?: boolean; diff --git a/react/features/base/config/functions.native.ts b/react/features/base/config/functions.native.ts index b737c23ff8..282282a897 100644 --- a/react/features/base/config/functions.native.ts +++ b/react/features/base/config/functions.native.ts @@ -20,7 +20,6 @@ export function _cleanupConfig(config: IConfig) { if (NativeModules.AppInfo.LIBRE_BUILD) { delete config.analytics?.amplitudeAPPKey; - delete config.analytics?.googleAnalyticsTrackingId; delete config.analytics?.rtcstatsEnabled; delete config.analytics?.rtcstatsEndpoint; delete config.analytics?.rtcstatsPollInterval; diff --git a/tsconfig.native.json b/tsconfig.native.json index 1a27ddd647..773de3541e 100644 --- a/tsconfig.native.json +++ b/tsconfig.native.json @@ -17,7 +17,6 @@ "exclude": [ "node_modules", "react/features/always-on-top", - "react/features/analytics/handlers/GoogleAnalyticsHandler.ts", "react/features/base/components/participants-pane-list", "react/features/base/tooltip", "react/features/connection-stats", diff --git a/webpack.config.js b/webpack.config.js index a7ef251fe1..d288065a81 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -314,16 +314,6 @@ module.exports = (_env, argv) => { ], performance: getPerformanceHints(perfHintOptions, 800 * 1024) }), - Object.assign({}, config, { - entry: { - 'analytics-ga': './react/features/analytics/handlers/GoogleAnalyticsHandler.ts' - }, - plugins: [ - ...config.plugins, - ...getBundleAnalyzerPlugin(analyzeBundle, 'analytics-ga') - ], - performance: getPerformanceHints(perfHintOptions, 35 * 1024) - }), Object.assign({}, config, { entry: { 'close3': './static/close3.js'