Skip to content

Commit

Permalink
fix(telemetry): remove obsolete parameters (#2135)
Browse files Browse the repository at this point in the history
  • Loading branch information
smalluban authored Dec 11, 2024
1 parent 3caabe5 commit d96b06d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 77 deletions.
1 change: 0 additions & 1 deletion src/background/telemetry/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ const setup = asyncSetup('telemetry', [

if (!metrics.installDate) {
metrics.installDate = new Date().toISOString().split('T')[0];
metrics.installRandom = Math.floor(Math.random() * 100) + 1;

const utms = await detectUTMs();
metrics.utm_source = utms.utm_source || '';
Expand Down
80 changes: 4 additions & 76 deletions src/background/telemetry/metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,31 +156,16 @@ export default class Metrics {
// Date of install (former install_date)
buildQueryPair('id', this.storage.installDate) +
// Product ID Parameter
buildQueryPair('pi', browserInfo.token === 'gd' ? 'gd' : 'gbe') +
//
// -- obsolete static parameters --
//
// Showing campaign messages (former show_cmp)
buildQueryPair('sc', '0') +
// Subscription Type
buildQueryPair('st', '-1') +
// New parameters for Ghostery 8.5.2
// Subscription Interval
buildQueryPair('si', '0');
buildQueryPair('pi', browserInfo.token === 'gd' ? 'gd' : 'gbe');

if (type !== 'uninstall') {
metrics_url +=
// Random number, assigned at install (former install_rand)
buildQueryPair('ir', this.storage.installRandom) +
// Adblocking state
buildQueryPair('ab', conf.blockAds ? '1' : '0') +
// Smartblocking state
buildQueryPair('sm', conf.blockAnnoyances ? '1' : '0') +
// Antitracking state
buildQueryPair('at', conf.blockTrackers ? '1' : '0') +
//
// -- generative parameters --
//
// Recency, days since last active daily ping
// prettier-ignore
buildQueryPair('rc', this._getRecencyActive(type, frequency).toString()) +
Expand All @@ -190,32 +175,7 @@ export default class Metrics {
// prettier-ignore
buildQueryPair('re',this._getRecencyEngaged(type, frequency).toString()) +
// Engaged Velocity
buildQueryPair('ve', this._getVelocityEngaged(type).toString()) +
//
// -- obsolete static parameters --
//
// Whether the computer ever had a Paid Subscription
buildQueryPair('ps', '0') +
// Human web
buildQueryPair('hw', '1') +
// Login state (former signed_in)
buildQueryPair('sn', '0') +
// Noncritical ping (former noncritical)
buildQueryPair('nc', '0') +
// Purplebox state (former purplebox)
buildQueryPair('pb', '0') +
// Extension_view - which view of the extension is the user in
buildQueryPair('ev', '1') +
// Onboarding status
buildQueryPair('ss', '1') +
// Onboarding last shown at
buildQueryPair('sl', 0) +
// Onboarding shown counter
buildQueryPair('sb', '1') +
// Theme
buildQueryPair('th', '0') +
// AB tests enabled?
buildQueryPair('ts', '0');
buildQueryPair('ve', this._getVelocityEngaged(type).toString());
}

if (CAMPAIGN_METRICS.includes(type)) {
Expand All @@ -227,14 +187,6 @@ export default class Metrics {
buildQueryPair('uc', this.storage.utm_campaign);
}

if (browserInfo.token === 'gd') {
// fetch metrics from the search extension and append them
const searchMetrics = await Metrics._getSearchExtensionMetrics();
Object.keys(searchMetrics).forEach((k) => {
metrics_url += buildQueryPair(k, searchMetrics[k]);
});
}

return metrics_url;
}

Expand Down Expand Up @@ -410,20 +362,7 @@ export default class Metrics {
this.storage.active_daily_velocity = active_daily_velocity;
this.saveStorage(this.storage);

const daily = this._timeToExpired('active', 'daily');
if (daily <= 0) {
this._sendReq('active', ['daily']);
}

const weekly = this._timeToExpired('active', 'weekly');
if (weekly <= 0) {
this._sendReq('active', ['weekly']);
}

const monthly = this._timeToExpired('active', 'monthly');
if (monthly <= 0) {
this._sendReq('active', ['monthly']);
}
this._sendReq('active', ['daily', 'weekly', 'monthly']);
}

/**
Expand Down Expand Up @@ -453,18 +392,7 @@ export default class Metrics {
this.storage.engaged_daily_count = engaged_daily_count;
this.storage.engaged_daily_velocity = engaged_daily_velocity;
this.saveStorage(this.storage);
this._sendReq('engaged', ['daily', 'weekly', 'monthly']);
}

static async _getSearchExtensionMetrics() {
return new Promise((resolve) => {
chrome.runtime.sendMessage(
'[email protected]',
'getMetrics',
(response) => {
resolve(response || {});
},
);
});
this._sendReq('engaged', ['daily', 'weekly', 'monthly']);
}
}

0 comments on commit d96b06d

Please sign in to comment.