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

GH-2229: Ghostery Browser New Telemetry #635

Merged
merged 3 commits into from Dec 8, 2020
Merged
Changes from 1 commit
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Next
Add function that returns the product ID
  • Loading branch information
benstrumeyer committed Dec 1, 2020
commit e7845687f183cf77a1f6a86a2ec098791a16ce2d
@@ -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.
*
ProTip! Use n and p to navigate between commits in a pull request.