1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-16 21:05:30 +03:00

Improvements to analytics collection.

This commit is contained in:
mikeller 2018-08-12 20:19:02 +12:00
parent 5a3bda615d
commit 6b7ac3e542
7 changed files with 122 additions and 10 deletions

View file

@ -15,12 +15,16 @@ $(document).ready(function () {
function checkSetupAnalytics(callback) {
if (!analytics) {
setTimeout(function () {
chrome.storage.local.get(['userId', 'analyticsOptOut'], function (result) {
if (!analytics) {
setupAnalytics(result);
}
chrome.storage.local.get(['userId', 'analyticsOptOut', 'checkForConfiguratorUnstableVersions', ], function (result) {
$.getJSON('version.json', function(data) {
var gitChangesetId = data.gitChangesetId;
callback(analytics);
if (!analytics) {
setupAnalytics(result, gitChangesetId);
}
callback(analytics);
});
});
});
} else if (callback) {
@ -28,7 +32,7 @@ function checkSetupAnalytics(callback) {
}
};
function setupAnalytics(result) {
function setupAnalytics(result, gitChangesetId) {
var userId;
if (result.userId) {
userId = result.userId;
@ -40,10 +44,11 @@ function setupAnalytics(result) {
}
var optOut = !!result.analyticsOptOut;
var checkForDebugVersions = !!result.checkForConfiguratorUnstableVersions;
var debugMode = process.versions['nw-flavor'] === 'sdk';
analytics = new Analytics('UA-123002063-1', userId, 'Betaflight Configurator', getManifestVersion(), GUI.operating_system, optOut, debugMode);
analytics = new Analytics('UA-123002063-1', userId, 'Betaflight Configurator', getManifestVersion(), gitChangesetId, GUI.operating_system, checkForDebugVersions, optOut, debugMode);
function logException(exception) {
analytics.sendException(exception.stack);
@ -69,6 +74,8 @@ function setupAnalytics(result) {
// Looks like we're in Chrome - but the event does not actually get fired
chrome.runtime.onSuspend.addListener(sendCloseEvent);
}
$('.connect_b a.connect').removeClass('disabled');
}
//Process to execute to real start the app