From e7845687f183cf77a1f6a86a2ec098791a16ce2d Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 1 Dec 2020 11:34:06 -0500 Subject: [PATCH 1/3] Add function that returns the product ID --- src/classes/Metrics.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/classes/Metrics.js b/src/classes/Metrics.js index e1138af4f..37b613032 100644 --- a/src/classes/Metrics.js +++ b/src/classes/Metrics.js @@ -25,7 +25,11 @@ const FREQUENCIES = { // in milliseconds }; const CRITICAL_METRICS = ['install', 'install_complete', 'upgrade', 'active', 'engaged', 'uninstall']; const CAMPAIGN_METRICS = ['install', 'active', 'uninstall']; -const { METRICS_BASE_URL, EXTENSION_VERSION, BROWSER_INFO } = globals; +const { + METRICS_BASE_URL, + EXTENSION_VERSION, + BROWSER_INFO, +} = globals; const MAX_DELAYED_PINGS = 100; // Set of conf keys used in constructing telemetry url const METRICS_URL_SET = new Set([ @@ -248,7 +252,7 @@ class Metrics { // Subscription Interval this._buildQueryPair('si', Metrics._getSubscriptionInterval().toString()) + // Product ID Parameter - this._buildQueryPair('pi', 'gbe'); + this._buildQueryPair('pi', Metrics._getProductID()); if (type !== 'uninstall') { metrics_url += @@ -347,6 +351,7 @@ class Metrics { if (this._checkPing(type, frequency)) { const timeNow = Number((new Date()).getTime()); const metrics_url = await this._buildMetricsUrl(type, frequency); + console.log('metrics_url: ', metrics_url); // update Conf timestamps for each ping type and frequency const metrics = conf.metrics || {}; metrics[`${type}_${frequency}`] = timeNow; @@ -369,6 +374,19 @@ class Metrics { }); } + /** + * Get the product ID + * + * @private + * + * @return {string} The Product ID + */ + static _getProductID() { + // Return 'gd' if the user is using the Ghostery Browser, 'gbe' otherwise + if (BROWSER_INFO.token === 'gd') return 'gd'; + return 'gbe'; + } + /** * Calculate days since the last daily active ping. * From 79529b98535bd3fadd7e51896daf6ec8617fc18d Mon Sep 17 00:00:00 2001 From: Ben Date: Tue, 1 Dec 2020 13:13:56 -0500 Subject: [PATCH 2/3] Remove console log --- src/classes/Metrics.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/classes/Metrics.js b/src/classes/Metrics.js index 37b613032..69e6b3c6a 100644 --- a/src/classes/Metrics.js +++ b/src/classes/Metrics.js @@ -25,11 +25,7 @@ const FREQUENCIES = { // in milliseconds }; const CRITICAL_METRICS = ['install', 'install_complete', 'upgrade', 'active', 'engaged', 'uninstall']; const CAMPAIGN_METRICS = ['install', 'active', 'uninstall']; -const { - METRICS_BASE_URL, - EXTENSION_VERSION, - BROWSER_INFO, -} = globals; +const { METRICS_BASE_URL, EXTENSION_VERSION, BROWSER_INFO } = globals; const MAX_DELAYED_PINGS = 100; // Set of conf keys used in constructing telemetry url const METRICS_URL_SET = new Set([ @@ -351,7 +347,6 @@ class Metrics { if (this._checkPing(type, frequency)) { const timeNow = Number((new Date()).getTime()); const metrics_url = await this._buildMetricsUrl(type, frequency); - console.log('metrics_url: ', metrics_url); // update Conf timestamps for each ping type and frequency const metrics = conf.metrics || {}; metrics[`${type}_${frequency}`] = timeNow; From 1a50e359b52d54ead5fedb68a8373a93220ad16e Mon Sep 17 00:00:00 2001 From: Ilya Zarembsky Date: Thu, 3 Dec 2020 13:33:48 -0500 Subject: [PATCH 3/3] Remove redundant comment --- src/classes/Metrics.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/classes/Metrics.js b/src/classes/Metrics.js index 69e6b3c6a..908515bb3 100644 --- a/src/classes/Metrics.js +++ b/src/classes/Metrics.js @@ -377,7 +377,6 @@ class Metrics { * @return {string} The Product ID */ static _getProductID() { - // Return 'gd' if the user is using the Ghostery Browser, 'gbe' otherwise if (BROWSER_INFO.token === 'gd') return 'gd'; return 'gbe'; }