Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

10.10-maintenance: Move analytics to its own domain and capture host #4036

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
});
}
}
Loading