Bläddra i källkod

feat(analytics) drop defunct Google Analytics integration

We haven't used in years. Those who want to use it can still create
their own custom script and include it, since it wasn't even included by
default.
factor2
Saúl Ibarra Corretgé 4 månader sedan
förälder
incheckning
b60210d0ad

+ 0
- 2
Makefile Visa fil

@@ -48,8 +48,6 @@ deploy-appbundle:
48 48
 		$(BUILD_DIR)/external_api.min.js.map \
49 49
 		$(BUILD_DIR)/alwaysontop.min.js \
50 50
 		$(BUILD_DIR)/alwaysontop.min.js.map \
51
-		$(BUILD_DIR)/analytics-ga.min.js \
52
-		$(BUILD_DIR)/analytics-ga.min.js.map \
53 51
 		$(BUILD_DIR)/face-landmarks-worker.min.js \
54 52
 		$(BUILD_DIR)/face-landmarks-worker.min.js.map \
55 53
 		$(BUILD_DIR)/noise-suppressor-worklet.min.js \

+ 0
- 4
config.js Visa fil

@@ -1091,9 +1091,6 @@ var config = {
1091 1091
         // True if the analytics should be disabled
1092 1092
         // disabled: false,
1093 1093
 
1094
-        // The Google Analytics Tracking ID:
1095
-        // googleAnalyticsTrackingId: 'your-tracking-id-UA-123456-1',
1096
-
1097 1094
         // Matomo configuration:
1098 1095
         // matomoEndpoint: 'https://your-matomo-endpoint/',
1099 1096
         // matomoSiteID: '42',
@@ -1131,7 +1128,6 @@ var config = {
1131 1128
 
1132 1129
         // Array of script URLs to load as lib-jitsi-meet "analytics handlers".
1133 1130
         // scriptURLs: [
1134
-        //      "libs/analytics-ga.min.js", // google-analytics
1135 1131
         //      "https://example.com/my-custom-analytics.js",
1136 1132
         // ],
1137 1133
 

+ 0
- 2
react/features/analytics/functions.ts Visa fil

@@ -87,7 +87,6 @@ export async function createHandlers({ getState }: IStore) {
87 87
         amplitudeIncludeUTM,
88 88
         blackListedEvents,
89 89
         scriptURLs,
90
-        googleAnalyticsTrackingId,
91 90
         matomoEndpoint,
92 91
         matomoSiteID,
93 92
         whiteListedEvents
@@ -98,7 +97,6 @@ export async function createHandlers({ getState }: IStore) {
98 97
         amplitudeIncludeUTM,
99 98
         blackListedEvents,
100 99
         envType: deploymentInfo?.envType || 'dev',
101
-        googleAnalyticsTrackingId,
102 100
         matomoEndpoint,
103 101
         matomoSiteID,
104 102
         group,

+ 0
- 1
react/features/analytics/handlers/AbstractHandler.ts Visa fil

@@ -14,7 +14,6 @@ interface IOptions {
14 14
     amplitudeIncludeUTM?: boolean;
15 15
     blackListedEvents?: string[];
16 16
     envType?: string;
17
-    googleAnalyticsTrackingId?: string;
18 17
     group?: string;
19 18
     host?: string;
20 19
     matomoEndpoint?: string;

+ 0
- 159
react/features/analytics/handlers/GoogleAnalyticsHandler.ts Visa fil

@@ -1,159 +0,0 @@
1
-/* global ga */
2
-
3
-import { getJitsiMeetGlobalNS } from '../../base/util/helpers';
4
-
5
-import AbstractHandler, { IEvent } from './AbstractHandler';
6
-
7
-/**
8
- * Analytics handler for Google Analytics.
9
- */
10
-class GoogleAnalyticsHandler extends AbstractHandler {
11
-    _userProperties: Object;
12
-    _userPropertiesString: string;
13
-
14
-    /**
15
-     * Creates new instance of the GA analytics handler.
16
-     *
17
-     * @param {Object} options - The Google Analytics options.
18
-     * @param {string} options.googleAnalyticsTrackingId - The GA track id
19
-     * required by the GA API.
20
-     */
21
-    constructor(options: any) {
22
-        super(options);
23
-
24
-        this._userProperties = {};
25
-
26
-        if (!options.googleAnalyticsTrackingId) {
27
-            throw new Error('Failed to initialize Google Analytics handler, no tracking ID');
28
-        }
29
-
30
-        this._enabled = true;
31
-        this._initGoogleAnalytics(options);
32
-    }
33
-
34
-    /**
35
-     * Initializes the ga object.
36
-     *
37
-     * @param {Object} options - The Google Analytics options.
38
-     * @param {string} options.googleAnalyticsTrackingId - The GA track id
39
-     * required by the GA API.
40
-     * @returns {void}
41
-     */
42
-    _initGoogleAnalytics(options: any) {
43
-        /**
44
-         * TODO: Keep this local, there's no need to add it to window.
45
-         */
46
-        /* eslint-disable */ // @ts-ignore
47
-        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
48
-            // @ts-ignore
49
-            (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)
50
-        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
51
-        /* eslint-enable */
52
-        // @ts-ignore
53
-        ga('create', options.googleAnalyticsTrackingId, 'auto');
54
-
55
-        // @ts-ignore
56
-        ga('send', 'pageview');
57
-    }
58
-
59
-    /**
60
-     * Extracts the integer to use for a Google Analytics event's value field
61
-     * from a lib-jitsi-meet analytics event.
62
-     *
63
-     * @param {Object} event - The lib-jitsi-meet analytics event.
64
-     * @returns {number} - The integer to use for the 'value' of a Google
65
-     * analytics event, or NaN if the lib-jitsi-meet event doesn't contain a
66
-     * suitable value.
67
-     * @private
68
-     */
69
-    _extractValue(event: IEvent) {
70
-        let value: string | number | undefined = event?.attributes?.value;
71
-
72
-        // Try to extract an integer from the "value" attribute.
73
-        value = Math.round(parseFloat(value ?? ''));
74
-
75
-        return value;
76
-    }
77
-
78
-    /**
79
-     * Extracts the string to use for a Google Analytics event's label field
80
-     * from a lib-jitsi-meet analytics event.
81
-     *
82
-     * @param {Object} event - The lib-jitsi-meet analytics event.
83
-     * @returns {string} - The string to use for the 'label' of a Google
84
-     * analytics event.
85
-     * @private
86
-     */
87
-    _extractLabel(event: IEvent) {
88
-        const { attributes = {} } = event;
89
-        const labelsArray
90
-            = Object.keys(attributes).map(key => `${key}=${attributes[key]}`);
91
-
92
-        labelsArray.push(this._userPropertiesString);
93
-
94
-        return labelsArray.join('&');
95
-    }
96
-
97
-    /**
98
-     * Sets the permanent properties for the current session.
99
-     *
100
-     * @param {Object} userProps - The permanent portperties.
101
-     * @returns {void}
102
-     */
103
-    setUserProperties(userProps: any = {}) {
104
-        if (!this._enabled) {
105
-            return;
106
-        }
107
-
108
-        // The label field is limited to 500B. We will concatenate all
109
-        // attributes of the event, except the user agent because it may be
110
-        // lengthy and is probably included from elsewhere.
111
-        const filter = [ 'user_agent', 'callstats_name' ];
112
-
113
-        this._userPropertiesString
114
-            = Object.keys(userProps)
115
-                .filter(key => filter.indexOf(key) === -1)
116
-                .map(key => `permanent_${key}=${userProps[key]}`)
117
-                .join('&');
118
-    }
119
-
120
-    /**
121
-     * This is the entry point of the API. The function sends an event to
122
-     * google analytics. The format of the event is described in
123
-     * analyticsAdapter in lib-jitsi-meet.
124
-     *
125
-     * @param {Object} event - The event in the format specified by
126
-     * lib-jitsi-meet.
127
-     * @returns {void}
128
-     */
129
-    sendEvent(event: IEvent) {
130
-        if (this._shouldIgnore(event)) {
131
-            return;
132
-        }
133
-
134
-        const gaEvent: {
135
-            eventAction?: string;
136
-            eventCategory: string;
137
-            eventLabel: string;
138
-            eventValue?: number;
139
-        } = {
140
-            'eventCategory': 'jitsi-meet',
141
-            'eventAction': this._extractName(event),
142
-            'eventLabel': this._extractLabel(event)
143
-        };
144
-        const value = this._extractValue(event);
145
-
146
-        if (!isNaN(value)) {
147
-            gaEvent.eventValue = value;
148
-        }
149
-
150
-        // @ts-ignore
151
-        ga('send', 'event', gaEvent);
152
-    }
153
-
154
-}
155
-
156
-const globalNS = getJitsiMeetGlobalNS();
157
-
158
-globalNS.analyticsHandlers = globalNS.analyticsHandlers || [];
159
-globalNS.analyticsHandlers.push(GoogleAnalyticsHandler);

+ 0
- 1
react/features/base/conference/functions.ts Visa fil

@@ -237,7 +237,6 @@ export function getConferenceOptions(stateful: IStateful) {
237 237
     if (options.disableThirdPartyRequests) {
238 238
         delete config.analytics?.scriptURLs;
239 239
         delete config.analytics?.amplitudeAPPKey;
240
-        delete config.analytics?.googleAnalyticsTrackingId;
241 240
     }
242 241
 
243 242
     return options;

+ 0
- 1
react/features/base/config/configType.ts Visa fil

@@ -185,7 +185,6 @@ export interface IConfig {
185 185
         amplitudeIncludeUTM?: boolean;
186 186
         blackListedEvents?: string[];
187 187
         disabled?: boolean;
188
-        googleAnalyticsTrackingId?: string;
189 188
         matomoEndpoint?: string;
190 189
         matomoSiteID?: string;
191 190
         obfuscateRoomName?: boolean;

+ 0
- 1
react/features/base/config/functions.native.ts Visa fil

@@ -20,7 +20,6 @@ export function _cleanupConfig(config: IConfig) {
20 20
 
21 21
     if (NativeModules.AppInfo.LIBRE_BUILD) {
22 22
         delete config.analytics?.amplitudeAPPKey;
23
-        delete config.analytics?.googleAnalyticsTrackingId;
24 23
         delete config.analytics?.rtcstatsEnabled;
25 24
         delete config.analytics?.rtcstatsEndpoint;
26 25
         delete config.analytics?.rtcstatsPollInterval;

+ 0
- 1
tsconfig.native.json Visa fil

@@ -17,7 +17,6 @@
17 17
     "exclude": [
18 18
         "node_modules",
19 19
         "react/features/always-on-top",
20
-        "react/features/analytics/handlers/GoogleAnalyticsHandler.ts",
21 20
         "react/features/base/components/participants-pane-list",
22 21
         "react/features/base/tooltip",
23 22
         "react/features/connection-stats",

+ 0
- 10
webpack.config.js Visa fil

@@ -314,16 +314,6 @@ module.exports = (_env, argv) => {
314 314
             ],
315 315
             performance: getPerformanceHints(perfHintOptions, 800 * 1024)
316 316
         }),
317
-        Object.assign({}, config, {
318
-            entry: {
319
-                'analytics-ga': './react/features/analytics/handlers/GoogleAnalyticsHandler.ts'
320
-            },
321
-            plugins: [
322
-                ...config.plugins,
323
-                ...getBundleAnalyzerPlugin(analyzeBundle, 'analytics-ga')
324
-            ],
325
-            performance: getPerformanceHints(perfHintOptions, 35 * 1024)
326
-        }),
327 317
         Object.assign({}, config, {
328 318
             entry: {
329 319
                 'close3': './static/close3.js'

Laddar…
Avbryt
Spara