1
0
Fork 0
mirror of https://github.com/betaflight/betaflight-configurator.git synced 2025-07-24 16:55:24 +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

@ -1473,6 +1473,12 @@ dialog {
transition: none;
}
.connect_b a.connect.disabled {
background-color: #808080;
pointer-events: none;
cursor: default;
}
.connect_b a.connect {
background-color: #ffbb00;
border: 1px solid #dba718;

View file

@ -1,6 +1,6 @@
'use strict';
var Analytics = function (trackingId, userId, appName, appVersion, buildType, optOut, debugMode) {
var Analytics = function (trackingId, userId, appName, appVersion, changesetId, buildType, checkForDebugVersions, optOut, debugMode) {
this._trackingId = trackingId;
this.setOptOut(optOut);
@ -58,6 +58,8 @@ var Analytics = function (trackingId, userId, appName, appVersion, buildType, op
FIRMWARE_CHANNEL: 10,
LOGGING_STATUS: 11,
MCU_ID: 12,
CONFIGURATOR_CHANGESET_ID: 13,
CONFIGURATOR_USE_DEBUG_VERSIONS: 14,
};
this.METRICS = {
@ -66,6 +68,8 @@ var Analytics = function (trackingId, userId, appName, appVersion, buildType, op
};
this.setDimension(this.DIMENSIONS.CONFIGURATOR_BUILD_TYPE, buildType);
this.setDimension(this.DIMENSIONS.CONFIGURATOR_CHANGESET_ID, changesetId);
this.setDimension(this.DIMENSIONS.CONFIGURATOR_USE_DEBUG_VERSIONS, checkForDebugVersions);
this.resetFlightControllerData();
this.resetFirmwareData();

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

View file

@ -125,7 +125,7 @@
<div id="port-picker">
<div class="connect_controls" id="connectbutton">
<div class="connect_b">
<a class="connect" href="#"></a>
<a class="connect disabled" href="#"></a>
</div>
<a class="connect_state" i18n="connect"></a>
</div>