Added tracking for firmware download channel.

10.4.x-maintenance
mikeller 2018-08-09 01:48:55 +12:00
parent 237dc08ca6
commit 91af936893
2 changed files with 11 additions and 5 deletions

View File

@ -37,6 +37,7 @@ var Analytics = function (trackingId, userId, appName, appVersion, buildType, op
MCU_ID: 'mcuId',
FIRMWARE_NAME: 'firmwareName',
FIRMWARE_CHECKSUM: 'firmwareChecksum',
FIRMWARE_SOURCE: 'firmwareSource',
FIRMWARE_CHANNEL: 'firmwareChannel',
FIRMWARE_ERASE_ALL: 'firmwareEraseAll',
};
@ -48,9 +49,10 @@ var Analytics = function (trackingId, userId, appName, appVersion, buildType, op
FIRMWARE_VERSION: 4,
API_VERSION: 5,
FIRMWARE_NAME: 6,
FIRMWARE_CHANNEL: 7,
FIRMWARE_SOURCE: 7,
FIRMWARE_ERASE_ALL: 8,
CONFIGURATOR_EXPERT_MODE: 9,
FIRMWARE_CHANNEL: 10,
};
this.setDimension(this.DIMENSIONS.CONFIGURATOR_BUILD_TYPE, buildType);
@ -118,8 +120,9 @@ Analytics.prototype.resetFlightControllerData = function () {
Analytics.prototype._rebuildFirmwareEvent = function () {
this.setDimension(this.DIMENSIONS.FIRMWARE_NAME, this._firmwareData[this.DATA.FIRMWARE_NAME]);
this.setDimension(this.DIMENSIONS.FIRMWARE_CHANNEL, this._firmwareData[this.DATA.FIRMWARE_CHANNEL]);
this.setDimension(this.DIMENSIONS.FIRMWARE_SOURCE, this._firmwareData[this.DATA.FIRMWARE_SOURCE]);
this.setDimension(this.DIMENSIONS.FIRMWARE_ERASE_ALL, this._firmwareData[this.DATA.FIRMWARE_ERASE_ALL]);
this.setDimension(this.DIMENSIONS.FIRMWARE_CHANNEL, this._firmwareData[this.DATA.FIRMWARE_CHANNEL]);
this._analytics.set('eventLabel', this._firmwareData[this.DATA.FIRMWARE_CHECKSUM]);
}

View File

@ -270,6 +270,8 @@ TABS.firmware_flasher.initialize = function (callback) {
i18n.localizePage();
buildType_e.change(function() {
analytics.setFirmwareData(analytics.DATA.FIRMWARE_CHANNEL, $(this).find('option:selected').text());
$("a.load_remote_file").addClass('disabled');
var build_type = $(this).val();
@ -325,7 +327,8 @@ TABS.firmware_flasher.initialize = function (callback) {
// UI Hooks
$('a.load_file').click(function () {
analytics.setFirmwareData(analytics.DATA.FIRMWARE_CHANNEL, 'file');
analytics.setFirmwareData(analytics.DATA.FIRMWARE_CHANNEL, undefined);
analytics.setFirmwareData(analytics.DATA.FIRMWARE_SOURCE, 'file');
chrome.fileSystem.chooseEntry({type: 'openFile', accepts: [{description: 'HEX files', extensions: ['hex']}]}, function (fileEntry) {
if (chrome.runtime.lastError) {
@ -390,7 +393,7 @@ TABS.firmware_flasher.initialize = function (callback) {
let isCached = FirmwareCache.has(release);
if (evt.target.value=="0" || isCached) {
if (isCached) {
analytics.setFirmwareData(analytics.DATA.FIRMWARE_CHANNEL, 'cache');
analytics.setFirmwareData(analytics.DATA.FIRMWARE_SOURCE, 'cache');
FirmwareCache.get(release, cached => {
analytics.setFirmwareData(analytics.DATA.FIRMWARE_NAME, release.file);
@ -406,7 +409,7 @@ TABS.firmware_flasher.initialize = function (callback) {
});
$('a.load_remote_file').click(function (evt) {
analytics.setFirmwareData(analytics.DATA.FIRMWARE_CHANNEL, 'http');
analytics.setFirmwareData(analytics.DATA.FIRMWARE_SOURCE, 'http');
if ($('select[name="firmware_version"]').val() == "0") {
GUI.log(i18n.getMessage('firmwareFlasherNoFirmwareSelected'));