Selaa lähdekoodia

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 kuukautta sitten
vanhempi
commit
b60210d0ad

+ 0
- 2
Makefile Näytä tiedosto

48
 		$(BUILD_DIR)/external_api.min.js.map \
48
 		$(BUILD_DIR)/external_api.min.js.map \
49
 		$(BUILD_DIR)/alwaysontop.min.js \
49
 		$(BUILD_DIR)/alwaysontop.min.js \
50
 		$(BUILD_DIR)/alwaysontop.min.js.map \
50
 		$(BUILD_DIR)/alwaysontop.min.js.map \
51
-		$(BUILD_DIR)/analytics-ga.min.js \
52
-		$(BUILD_DIR)/analytics-ga.min.js.map \
53
 		$(BUILD_DIR)/face-landmarks-worker.min.js \
51
 		$(BUILD_DIR)/face-landmarks-worker.min.js \
54
 		$(BUILD_DIR)/face-landmarks-worker.min.js.map \
52
 		$(BUILD_DIR)/face-landmarks-worker.min.js.map \
55
 		$(BUILD_DIR)/noise-suppressor-worklet.min.js \
53
 		$(BUILD_DIR)/noise-suppressor-worklet.min.js \

+ 0
- 4
config.js Näytä tiedosto

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

+ 0
- 2
react/features/analytics/functions.ts Näytä tiedosto

87
         amplitudeIncludeUTM,
87
         amplitudeIncludeUTM,
88
         blackListedEvents,
88
         blackListedEvents,
89
         scriptURLs,
89
         scriptURLs,
90
-        googleAnalyticsTrackingId,
91
         matomoEndpoint,
90
         matomoEndpoint,
92
         matomoSiteID,
91
         matomoSiteID,
93
         whiteListedEvents
92
         whiteListedEvents
98
         amplitudeIncludeUTM,
97
         amplitudeIncludeUTM,
99
         blackListedEvents,
98
         blackListedEvents,
100
         envType: deploymentInfo?.envType || 'dev',
99
         envType: deploymentInfo?.envType || 'dev',
101
-        googleAnalyticsTrackingId,
102
         matomoEndpoint,
100
         matomoEndpoint,
103
         matomoSiteID,
101
         matomoSiteID,
104
         group,
102
         group,

+ 0
- 1
react/features/analytics/handlers/AbstractHandler.ts Näytä tiedosto

14
     amplitudeIncludeUTM?: boolean;
14
     amplitudeIncludeUTM?: boolean;
15
     blackListedEvents?: string[];
15
     blackListedEvents?: string[];
16
     envType?: string;
16
     envType?: string;
17
-    googleAnalyticsTrackingId?: string;
18
     group?: string;
17
     group?: string;
19
     host?: string;
18
     host?: string;
20
     matomoEndpoint?: string;
19
     matomoEndpoint?: string;

+ 0
- 159
react/features/analytics/handlers/GoogleAnalyticsHandler.ts Näytä tiedosto

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 Näytä tiedosto

237
     if (options.disableThirdPartyRequests) {
237
     if (options.disableThirdPartyRequests) {
238
         delete config.analytics?.scriptURLs;
238
         delete config.analytics?.scriptURLs;
239
         delete config.analytics?.amplitudeAPPKey;
239
         delete config.analytics?.amplitudeAPPKey;
240
-        delete config.analytics?.googleAnalyticsTrackingId;
241
     }
240
     }
242
 
241
 
243
     return options;
242
     return options;

+ 0
- 1
react/features/base/config/configType.ts Näytä tiedosto

185
         amplitudeIncludeUTM?: boolean;
185
         amplitudeIncludeUTM?: boolean;
186
         blackListedEvents?: string[];
186
         blackListedEvents?: string[];
187
         disabled?: boolean;
187
         disabled?: boolean;
188
-        googleAnalyticsTrackingId?: string;
189
         matomoEndpoint?: string;
188
         matomoEndpoint?: string;
190
         matomoSiteID?: string;
189
         matomoSiteID?: string;
191
         obfuscateRoomName?: boolean;
190
         obfuscateRoomName?: boolean;

+ 0
- 1
react/features/base/config/functions.native.ts Näytä tiedosto

20
 
20
 
21
     if (NativeModules.AppInfo.LIBRE_BUILD) {
21
     if (NativeModules.AppInfo.LIBRE_BUILD) {
22
         delete config.analytics?.amplitudeAPPKey;
22
         delete config.analytics?.amplitudeAPPKey;
23
-        delete config.analytics?.googleAnalyticsTrackingId;
24
         delete config.analytics?.rtcstatsEnabled;
23
         delete config.analytics?.rtcstatsEnabled;
25
         delete config.analytics?.rtcstatsEndpoint;
24
         delete config.analytics?.rtcstatsEndpoint;
26
         delete config.analytics?.rtcstatsPollInterval;
25
         delete config.analytics?.rtcstatsPollInterval;

+ 0
- 1
tsconfig.native.json Näytä tiedosto

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

+ 0
- 10
webpack.config.js Näytä tiedosto

314
             ],
314
             ],
315
             performance: getPerformanceHints(perfHintOptions, 800 * 1024)
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
         Object.assign({}, config, {
317
         Object.assign({}, config, {
328
             entry: {
318
             entry: {
329
                 'close3': './static/close3.js'
319
                 'close3': './static/close3.js'

Loading…
Peruuta
Tallenna