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 1763/metrics feature/new triggers for broken page pings #430

Closed
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4ecd3d0
Update broken ping reload threshhold to 60 seconds
wlycdgr Jul 17, 2019
9c74083
Merge branch 'develop' into GH-1763/metrics-feature/new-triggers-for-…
wlycdgr Jul 19, 2019
1ed578e
Add startPossibleBrokenPageTimer method to Metrics, implement the del…
wlycdgr Jul 22, 2019
99305fc
Implement metrics broken page trigger handler that uses existing even…
wlycdgr Jul 22, 2019
52e9a7a
Add setup_pth and setup_block parameters to broken_page ping
wlycdgr Jul 22, 2019
311b498
Clear and reset broken page watcher setTimeout handler if a new trigg…
wlycdgr Jul 22, 2019
dd1d215
Add pause Ghostery trigger for Metrics broken page watcher
wlycdgr Jul 22, 2019
49281a8
Add local tracker unblock trigger for Metrics broken page watcher.
wlycdgr Jul 22, 2019
5e5d996
Handle new tab creation for broken page watcher. Add documentation co…
wlycdgr Jul 23, 2019
f2c49ab
Remove broken page metrics ping call from TabInfo#create
wlycdgr Jul 23, 2019
0664aa5
Revert smart unblock threshold to 30 seconds. Add comments explaining…
wlycdgr Jul 23, 2019
28da0df
Trigger metrics broken page watcher on individual tracker site specif…
wlycdgr Jul 23, 2019
e7cd1bc
Pacify linter
wlycdgr Jul 23, 2019
e0076c1
Only set broken page watcher on whitelist add, not both add and remove
wlycdgr Jul 23, 2019
b9cf1ee
Change this.BROKEN_APGE_NEW_TAB value to a less mysterious 5. RIP Age…
wlycdgr Jul 23, 2019
0f5a592
Merge branch 'develop' into GH-1763/metrics-feature/new-triggers-for-…
wlycdgr Jul 29, 2019
d286689
Correct timeout handler name in Metrics#_resetBrokenPageWatcher
wlycdgr Jul 29, 2019
aa76f53
Correct broken_page ping name in Metrics#handleBrokenPageTrigger
wlycdgr Jul 29, 2019
4e18aaa
Bind setTimeout handler to Metrics instance in getActiveTab callback …
wlycdgr Jul 29, 2019
6634a9b
Merge branch 'develop' into GH-1763/metrics-feature/new-triggers-for-…
christophertino Jul 29, 2019
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

Add pause Ghostery trigger for Metrics broken page watcher
  • Loading branch information
wlycdgr committed Jul 22, 2019
commit dd1d21505e3f1033570ae0d72f5b5f366979c2f3
@@ -1101,7 +1101,7 @@ function initializeDispatcher() {
button.update();
utils.flushChromeMemoryCache();
cliqz.modules.core.action('refreshAppState');
metrics.handleBrokenPageTrigger(globals.BROKEN_PAGE_WHITELISTED);
metrics.handleBrokenPageTrigger(globals.BROKEN_PAGE_WHITELIST);
});
dispatcher.on('conf.save.enable_human_web', (enableHumanWeb) => {
if (!IS_CLIQZ) {
@@ -1157,6 +1157,7 @@ function initializeDispatcher() {

dispatcher.on('globals.save.paused_blocking', () => {
// update content script state when blocking is paused/unpaused
if (globals.SESSION.paused_blocking) { metrics.handleBrokenPageTrigger(globals.BROKEN_PAGE_PAUSE); }
cliqz.modules.core.action('refreshAppState');
});
}
@@ -72,7 +72,8 @@ class Globals {

// Broken page metrics named constants
this.BROKEN_PAGE_REFRESH = 1;
this.BROKEN_PAGE_WHITELISTED = 2;
this.BROKEN_PAGE_WHITELIST = 2;
this.BROKEN_PAGE_PAUSE = 3;

// data stores
this.REDIRECT_MAP = new Map();
@@ -41,7 +41,7 @@ class Metrics {
this.utm_campaign = '';
this.ping_set = new Set();
this._brokenPageWatcher = {
flag: false,
on: false,
triggerId: '',
triggerTime: '',
timeoutId: null,
@@ -119,29 +119,41 @@ class Metrics {
case globals.BROKEN_PAGE_REFRESH:
if (this._brokenPageWatcher.flag) {
this.ping('broken-page');
this._clearBrokenPageWatcher();
this._unplugBrokenPageWatcher();
} else {
this._setBrokenPageWatcher(triggerId);
this._rebootBrokenPageWatcher(triggerId);
}
break;
case globals.BROKEN_PAGE_WHITELIST:
if (this._brokenPageWatcher.flag) {
this.ping('broken-page');
this._unplugBrokenPageWatcher();
}
break;
case globals.BROKEN_PAGE_PAUSE:
if (this._brokenPageWatcher.flag) {
this.ping('broken-page');
this._unplugBrokenPageWatcher();
}
break;
default:
break;
}
}

_clearBrokenPageWatcher() {
this._brokenPageWatcher = Object.assign({}, {
_unplugBrokenPageWatcher() {
this._clearBrokenPageWatcherTimeout();

this._brokenPageWatcher = Object.assign({},{
flag: false,
triggerId: '',
triggerTime: '',
timeoutId: null,
});
}

_setBrokenPageWatcher(triggerId) {
const { timeoutId } = this._brokenPageWatcher;

if (timeoutId) { clearTimeout(timeoutId); }
_rebootBrokenPageWatcher(triggerId) {
this._clearBrokenPageWatcherTimeout();

this._brokenPageWatcher = Object.assign({}, {
flag: true,
@@ -151,6 +163,11 @@ class Metrics {
});
}

_clearBrokenPageWatcherTimeout() {
const { timeoutId } = this._brokenPageWatcher;
if (timeoutId) { clearTimeout(timeoutId); }
}

/**
* Prepare data and send telemetry pings.
* @param {string} type type of the telemetry ping
ProTip! Use n and p to navigate between commits in a pull request.