Skip to content

Commit

Permalink
10.10-maintenance: Move analytics to its own domain and capture host (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
blckmn authored Jun 21, 2024
1 parent daf55aa commit 2ad84f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
19 changes: 13 additions & 6 deletions src/js/Analytics.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import ShortUniqueId from 'short-unique-id';
import BuildApi from './BuildApi';
import { set as setConfig, get as getConfig } from './ConfigStorage';
import GUI from './gui';
import CONFIGURATOR from './data_storage';
Expand Down Expand Up @@ -74,7 +73,7 @@ class Analytics {
this.setOptOut(settings.optOut);

this._settings = settings;
this._api = new BuildApi();
this._url = 'https://analytics.betaflight.com';

this.EVENT_CATEGORIES = {
APPLICATION: 'Application',
Expand All @@ -90,11 +89,19 @@ class Analytics {
return;
}

this._api.sendAnalytics(name, {
sessionId: this._settings.sessionId,
userId: this._settings.userId,
[name]: properties,
const url = `${this._url}/analytics/${name}`;
$.ajax({
url: url,
type: "POST",
data: JSON.stringify({
sessionId: this._settings.sessionId,
userId: this._settings.userId,
[name]: properties,
}),
contentType: "application/json",
dataType: "json",
});

}

sendSettings() {
Expand Down
11 changes: 0 additions & 11 deletions src/js/BuildApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,4 @@ export default class BuildApi {
}
});
}

sendAnalytics(type, parcel) {
const url = `${this._url}/analytics/${type}`;
$.ajax({
url: url,
type: "POST",
data: JSON.stringify(parcel),
contentType: "application/json",
dataType: "json",
});
}
}

0 comments on commit 2ad84f2

Please sign in to comment.