Skip to content

Commit b6d8efc

Browse files
authored
Remove Google Analytics (#3148)
1 parent 96aeab6 commit b6d8efc

24 files changed

+30
-743
lines changed

libraries/analytics.js

Lines changed: 0 additions & 58 deletions
This file was deleted.

src/js/Analytics.js

Lines changed: 0 additions & 180 deletions
This file was deleted.

src/js/CliAutoComplete.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ CliAutoComplete.setEnabled = function(enable) {
5151
};
5252

5353
CliAutoComplete.initialize = function($textarea, sendLine, writeToOutput) {
54-
analytics.sendEvent(analytics.EVENT_CATEGORIES.APPLICATION, 'CliAutoComplete', this.configEnabled);
55-
5654
this.$textarea = $textarea;
5755
this.forceOpen = false;
5856
this.sendLine = sendLine;

src/js/Features.js

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,23 +39,14 @@ const Features = function (config) {
3939

4040
self._features = features;
4141
self._featureMask = 0;
42-
43-
self._analyticsChanges = {};
4442
};
4543

4644
Features.prototype.getMask = function () {
47-
const self = this;
48-
49-
analytics.sendChangeEvents(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, self._analyticsChanges);
50-
self._analyticsChanges = {};
51-
52-
return self._featureMask;
45+
return this._featureMask;
5346
};
5447

5548
Features.prototype.setMask = function (featureMask) {
56-
const self = this;
57-
58-
self._featureMask = featureMask;
49+
this._featureMask = featureMask;
5950
};
6051

6152
Features.prototype.isEnabled = function (featureName) {
@@ -168,33 +159,25 @@ Features.prototype.updateData = function (featureElement) {
168159

169160
if (featureElement.attr('type') === 'checkbox') {
170161
const bit = featureElement.data('bit');
171-
let featureValue;
172162

173163
if (featureElement.is(':checked')) {
174164
self._featureMask = bit_set(self._featureMask, bit);
175-
featureValue = 'On';
176165
} else {
177166
self._featureMask = bit_clear(self._featureMask, bit);
178-
featureValue = 'Off';
179167
}
180-
self._analyticsChanges[`Feature${self.findFeatureByBit(bit).name}`] = featureValue;
181168
} else if (featureElement.prop('localName') === 'select') {
182169
const controlElements = featureElement.children();
183170
const selectedBit = featureElement.val();
171+
184172
if (selectedBit !== -1) {
185-
let selectedFeature;
186173
for (const controlElement of controlElements) {
187174
const bit = controlElement.value;
188175
if (selectedBit === bit) {
189176
self._featureMask = bit_set(self._featureMask, bit);
190-
selectedFeature = self.findFeatureByBit(bit);
191177
} else {
192178
self._featureMask = bit_clear(self._featureMask, bit);
193179
}
194180
}
195-
if (selectedFeature) {
196-
self._analyticsChanges[`FeatureGroup-${selectedFeature.group}`] = selectedFeature.name;
197-
}
198181
}
199182
}
200183
};

src/js/backup_restore.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ function configuration_backup(callback) {
225225
return;
226226
}
227227

228-
analytics.sendEvent(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, 'Backup');
229228
console.log('Write SUCCESSFUL');
230229
if (callback) callback();
231230
};
@@ -308,8 +307,6 @@ function configuration_restore(callback) {
308307
configuration.FEATURE_CONFIG.features = features;
309308
}
310309

311-
analytics.sendEvent(analytics.EVENT_CATEGORIES.FLIGHT_CONTROLLER, 'Restore');
312-
313310
configuration_upload(configuration, callback);
314311
} else {
315312
GUI.log(i18n.getMessage('backupFileIncompatible'));

src/js/main.js

Lines changed: 3 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -57,64 +57,11 @@ function appReady() {
5757
i18n.init(function() {
5858
startProcess();
5959

60-
checkSetupAnalytics(function (analyticsService) {
61-
analyticsService.sendEvent(analyticsService.EVENT_CATEGORIES.APPLICATION, 'SelectedLanguage', i18n.selectedLanguage);
62-
});
63-
6460
initializeSerialBackend();
65-
});
66-
}
67-
68-
function checkSetupAnalytics(callback) {
69-
if (!analytics) {
70-
setTimeout(function () {
71-
const result = ConfigStorage.get(['userId', 'analyticsOptOut', 'checkForConfiguratorUnstableVersions' ]);
72-
if (!analytics) {
73-
setupAnalytics(result);
74-
}
75-
76-
callback(analytics);
77-
});
78-
} else if (callback) {
79-
callback(analytics);
80-
}
81-
}
82-
83-
function getBuildType() {
84-
return GUI.Mode;
85-
}
86-
87-
function setupAnalytics(result) {
88-
let userId;
89-
if (result.userId) {
90-
userId = result.userId;
91-
} else {
92-
const uid = new ShortUniqueId();
93-
userId = uid.randomUUID(13);
94-
95-
ConfigStorage.set({ 'userId': userId });
96-
}
9761

98-
const optOut = !!result.analyticsOptOut;
99-
const checkForDebugVersions = !!result.checkForConfiguratorUnstableVersions;
100-
101-
const debugMode = typeof process === "object" && process.versions['nw-flavor'] === 'sdk';
102-
103-
window.analytics = new Analytics('UA-123002063-1', userId, CONFIGURATOR.productName, CONFIGURATOR.version, CONFIGURATOR.gitRevision, GUI.operating_system,
104-
checkForDebugVersions, optOut, debugMode, getBuildType());
105-
106-
function logException(exception) {
107-
analytics.sendException(exception.stack);
108-
}
109-
110-
if (typeof process === "object") {
111-
process.on('uncaughtException', logException);
112-
}
113-
114-
analytics.sendEvent(analytics.EVENT_CATEGORIES.APPLICATION, 'AppStart', { sessionControl: 'start' });
115-
116-
$('.connect_b a.connect').removeClass('disabled');
117-
$('.firmware_b a.flash').removeClass('disabled');
62+
$('.connect_b a.connect').removeClass('disabled');
63+
$('.firmware_b a.flash').removeClass('disabled');
64+
});
11865
}
11966

12067
function closeSerial() {
@@ -177,8 +124,6 @@ function closeHandler() {
177124
this.hide();
178125
}
179126

180-
analytics.sendEvent(analytics.EVENT_CATEGORIES.APPLICATION, 'AppClose', { sessionControl: 'end' });
181-
182127
closeSerial();
183128

184129
if (!GUI.isCordova()) {
@@ -313,10 +258,6 @@ function startProcess() {
313258
GUI.tab_switch_in_progress = false;
314259
}
315260

316-
checkSetupAnalytics(function (analyticsService) {
317-
analyticsService.sendAppView(tab);
318-
});
319-
320261
switch (tab) {
321262
case 'landing':
322263
import("./tabs/landing").then(({ landing }) =>
@@ -573,9 +514,6 @@ function startProcess() {
573514

574515
$(expertModeCheckbox).on("change", () => {
575516
const checked = $(expertModeCheckbox).is(':checked');
576-
checkSetupAnalytics(function (analyticsService) {
577-
analyticsService.setDimension(analyticsService.DIMENSIONS.CONFIGURATOR_EXPERT_MODE, checked ? 'On' : 'Off');
578-
});
579517

580518
if (FC.FEATURE_CONFIG && FC.FEATURE_CONFIG.features !== 0) {
581519
updateTabList(FC.FEATURE_CONFIG.features);
@@ -619,10 +557,6 @@ function startProcess() {
619557

620558
function setDarkTheme(enabled) {
621559
DarkTheme.setConfig(enabled);
622-
623-
checkSetupAnalytics(function (analyticsService) {
624-
analyticsService.sendEvent(analyticsService.EVENT_CATEGORIES.APPLICATION, 'DarkTheme', enabled);
625-
});
626560
}
627561

628562

@@ -788,13 +722,10 @@ function showErrorDialog(message) {
788722

789723
// TODO: all of these are used as globals in other parts.
790724
// once moved to modules extract to own module.
791-
window.googleAnalytics = analytics;
792-
window.analytics = null;
793725
window.showErrorDialog = showErrorDialog;
794726
window.generateFilename = generateFilename;
795727
window.updateTabList = updateTabList;
796728
window.isExpertModeEnabled = isExpertModeEnabled;
797729
window.checkForConfiguratorUpdates = checkForConfiguratorUpdates;
798730
window.setDarkTheme = setDarkTheme;
799731
window.appReady = appReady;
800-
window.checkSetupAnalytics = checkSetupAnalytics;

0 commit comments

Comments
 (0)