Skip to content

Commit

Permalink
Files.app: Clear the analytics ID every time the app starts.
Browse files Browse the repository at this point in the history
BUG=461946

TBR=mtomasz

Review URL: https://codereview.chromium.org/961863004

Cr-Commit-Position: refs/heads/master@{#318301}
  • Loading branch information
kenobi authored and Commit bot committed Feb 26, 2015
1 parent 1643447 commit fb62911
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ui/file_manager/file_manager/background/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,14 @@ FileBrowserBackground.prototype.initContextMenu_ = function() {
});
};

// Ensure that the user gets a new analytics ID each time Files.app starts.
// NOTE: This must be called before FileBrowserBackground is instantiated.
// TODO(kenobi): Revisit this once users have the ability to do this themselves.
metrics.clearUserId();

/**
* Singleton instance of Background.
* NOTE: This must come after the call to metrics.clearUserId.
* @type {FileBrowserBackground}
*/
window.background = new FileBrowserBackground();
13 changes: 13 additions & 0 deletions ui/file_manager/file_manager/common/js/metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,16 @@ metrics.umaEnabledFilter_ = function(hit) {
hit.cancel();
}
};

/**
* Clears the previously set analytics user id.
*/
metrics.clearUserId = function() {
chrome.storage.local.remove(
'google-analytics.analytics.user-id',
function () {
if (chrome.runtime.lastError) {
throw new Error(chrome.runtime.lastError.message);
}
});
};

0 comments on commit fb62911

Please sign in to comment.