Commit 1dcbeba9 authored by Mihai Sardarescu's avatar Mihai Sardarescu Committed by Commit Bot

[dice] Record Signin_Impression{With|WithNo}Account_FromSettings

This CL records the following user actions when Desktop Identity Consistency
is enabled:
* Signin_ImpressionWithAccount_FromSettings
* Signin_ImpressionWithNoAccount_FromSettings

Bug: 833282
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: Ie15cbf5c74466755559cf7d3359b76973ee5dc6f
Reviewed-on: https://chromium-review.googlesource.com/1016919Reviewed-by: default avatarScott Chen <scottchen@chromium.org>
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553038}
parent 1153e141
......@@ -261,13 +261,21 @@ Polymer({
* @private
*/
handleSyncStatus_: function(syncStatus) {
if (!this.syncStatus && syncStatus && !syncStatus.signedIn)
chrome.metricsPrivate.recordUserAction('Signin_Impression_FromSettings');
// Sign-in impressions should be recorded only if the sign-in promo is
// shown. They should be recorder only once, the first time
// |this.syncStatus| is set.
const shouldRecordSigninImpression =
!this.syncStatus && syncStatus && this.showSignin_(syncStatus);
if (!syncStatus.signedIn && this.showDisconnectDialog_)
this.$$('#disconnectDialog').close();
this.syncStatus = syncStatus;
if (shouldRecordSigninImpression && !this.shouldShowSyncAccountControl_()) {
// SyncAccountControl records the impressions user actions.
chrome.metricsPrivate.recordUserAction('Signin_Impression_FromSettings');
}
},
/** @private */
......
......@@ -84,6 +84,27 @@ Polymer({
'stored-accounts-updated', this.handleStoredAccounts_.bind(this));
},
/**
* Records the following user actions:
* - Signin_Impression_FromSettings and
* - Signin_ImpressionWithAccount_FromSettings
* - Signin_ImpressionWithNoAccount_FromSettings
* @private
*/
recordImpressionUserActions_: function() {
assert(!this.syncStatus.signedIn);
assert(this.shownAccount_ !== undefined);
chrome.metricsPrivate.recordUserAction('Signin_Impression_FromSettings');
if (this.shownAccount_) {
chrome.metricsPrivate.recordUserAction(
'Signin_ImpressionWithAccount_FromSettings');
} else {
chrome.metricsPrivate.recordUserAction(
'Signin_ImpressionWithNoAccount_FromSettings');
}
},
/**
* @return {boolean}
* @private
......@@ -108,6 +129,8 @@ Polymer({
// Turn off the promo if the user is signed in.
this.showingPromo = false;
}
if (!this.syncStatus.signedIn && this.shownAccount_ !== undefined)
this.recordImpressionUserActions_();
},
/**
......@@ -257,8 +280,23 @@ Polymer({
}
}
} else {
this.shownAccount_ =
this.storedAccounts_ ? this.storedAccounts_[0] : null;
const firstStoredAccount =
(this.storedAccounts_.length > 0) ? this.storedAccounts_[0] : null;
// Sign-in impressions should be recorded in the following cases:
// 1. When the promo is first shown, i.e. when |shownAccount_| is
// initialized;
// 2. When the impression account state changes, i.e. promo impression
// state changes (WithAccount -> WithNoAccount) or
// (WithNoAccount -> WithAccount).
const shouldRecordImpression = (this.shownAccount_ === undefined) ||
(!this.shownAccount_ && firstStoredAccount) ||
(this.shownAccount_ && !firstStoredAccount);
this.shownAccount_ = firstStoredAccount;
if (shouldRecordImpression)
this.recordImpressionUserActions_();
}
}
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment