Skip to content

Commit 2ad84f2

Browse files
authored
10.10-maintenance: Move analytics to its own domain and capture host (#4036)
1 parent daf55aa commit 2ad84f2

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

src/js/Analytics.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import ShortUniqueId from 'short-unique-id';
2-
import BuildApi from './BuildApi';
32
import { set as setConfig, get as getConfig } from './ConfigStorage';
43
import GUI from './gui';
54
import CONFIGURATOR from './data_storage';
@@ -74,7 +73,7 @@ class Analytics {
7473
this.setOptOut(settings.optOut);
7574

7675
this._settings = settings;
77-
this._api = new BuildApi();
76+
this._url = 'https://analytics.betaflight.com';
7877

7978
this.EVENT_CATEGORIES = {
8079
APPLICATION: 'Application',
@@ -90,11 +89,19 @@ class Analytics {
9089
return;
9190
}
9291

93-
this._api.sendAnalytics(name, {
94-
sessionId: this._settings.sessionId,
95-
userId: this._settings.userId,
96-
[name]: properties,
92+
const url = `${this._url}/analytics/${name}`;
93+
$.ajax({
94+
url: url,
95+
type: "POST",
96+
data: JSON.stringify({
97+
sessionId: this._settings.sessionId,
98+
userId: this._settings.userId,
99+
[name]: properties,
100+
}),
101+
contentType: "application/json",
102+
dataType: "json",
97103
});
104+
98105
}
99106

100107
sendSettings() {

src/js/BuildApi.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,4 @@ export default class BuildApi {
182182
}
183183
});
184184
}
185-
186-
sendAnalytics(type, parcel) {
187-
const url = `${this._url}/analytics/${type}`;
188-
$.ajax({
189-
url: url,
190-
type: "POST",
191-
data: JSON.stringify(parcel),
192-
contentType: "application/json",
193-
dataType: "json",
194-
});
195-
}
196185
}

0 commit comments

Comments
 (0)