Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: components/signin/core/browser/signin_metrics.cc

Issue 338573002: Differentiate primary account compares on GAIA cookie presence. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/signin/core/browser/signin_metrics.h" 5 #include "components/signin/core/browser/signin_metrics.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/metrics/user_metrics.h" 9 #include "base/metrics/user_metrics.h"
10 10
11 namespace signin_metrics { 11 namespace signin_metrics {
12 12
13 // Enum for the ways in which primary account detection is done.
14 enum DifferentPrimaryAccounts {
15 // token and cookie had same primary accounts.
16 ACCOUNTS_SAME = 0,
17 // Deprecated. Indicates different primary accounts.
18 UNUSED_ACCOUNTS_DIFFERENT,
19 // No GAIA cookie present, so the primaries are considered different.
20 NO_COOKIE_PRESENT,
21 // There was at least one cookie and one token, and the primaries differed.
22 COOKIE_AND_TOKEN_PRIMARIES_DIFFERENT,
23 NUM_DIFFERENT_PRIMARY_ACCOUNT_METRICS,
24 };
25
26 // Helper method to determine which |DifferentPrimaryAccounts| applies.
27 DifferentPrimaryAccounts ComparePrimaryAccounts(bool primary_accounts_same,
28 int pre_count_gaia_cookies) {
Alexei Svitkine (slow) 2014/06/17 19:43:04 Nit: Align or if it doesn't fit, wrap both params.
29 if (primary_accounts_same)
30 return ACCOUNTS_SAME;
31 if (pre_count_gaia_cookies == 0)
32 return NO_COOKIE_PRESENT;
33 return COOKIE_AND_TOKEN_PRIMARIES_DIFFERENT;
34 }
35
13 void LogSigninAccountReconciliation(int total_number_accounts, 36 void LogSigninAccountReconciliation(int total_number_accounts,
14 int count_added_to_cookie_jar, 37 int count_added_to_cookie_jar,
15 int count_added_to_token, 38 int count_added_to_token,
16 bool primary_accounts_same, 39 bool primary_accounts_same,
17 bool is_first_reconcile) { 40 bool is_first_reconcile,
41 int pre_count_gaia_cookies) {
18 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfAccountsPerProfile", 42 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfAccountsPerProfile",
19 total_number_accounts); 43 total_number_accounts);
20 // We want to include zeroes in the counts of added accounts to easily 44 // We want to include zeroes in the counts of added accounts to easily
21 // capture _relatively_ how often we merge accounts. 45 // capture _relatively_ how often we merge accounts.
22 if (is_first_reconcile) { 46 if (is_first_reconcile) {
23 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToCookieJar.FirstRun", 47 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToCookieJar.FirstRun",
24 count_added_to_cookie_jar); 48 count_added_to_cookie_jar);
25 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToChrome.FirstRun", 49 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToChrome.FirstRun",
26 count_added_to_token); 50 count_added_to_token);
27 UMA_HISTOGRAM_BOOLEAN("Signin.Reconciler.DifferentPrimaryAccounts.FirstRun", 51 UMA_HISTOGRAM_ENUMERATION(
28 !primary_accounts_same); 52 "Signin.Reconciler.DifferentPrimaryAccounts.FirstRun",
53 ComparePrimaryAccounts(primary_accounts_same, pre_count_gaia_cookies),
54 NUM_DIFFERENT_PRIMARY_ACCOUNT_METRICS);
29 } else { 55 } else {
30 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToCookieJar.SubsequentRun", 56 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToCookieJar.SubsequentRun",
31 count_added_to_cookie_jar); 57 count_added_to_cookie_jar);
32 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToChrome.SubsequentRun", 58 UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToChrome.SubsequentRun",
33 count_added_to_token); 59 count_added_to_token);
34 UMA_HISTOGRAM_BOOLEAN( 60 UMA_HISTOGRAM_ENUMERATION(
35 "Signin.Reconciler.DifferentPrimaryAccounts.SubsequentRun", 61 "Signin.Reconciler.DifferentPrimaryAccounts.SubsequentRun",
36 !primary_accounts_same); 62 ComparePrimaryAccounts(primary_accounts_same, pre_count_gaia_cookies),
63 NUM_DIFFERENT_PRIMARY_ACCOUNT_METRICS);
37 } 64 }
38 } 65 }
39 66
40 void LogSigninAddAccount() { 67 void LogSigninAddAccount() {
41 // Account signin may fail for a wide variety of reasons. There is no 68 // Account signin may fail for a wide variety of reasons. There is no
42 // explicit false, but one can compare this value with the various UI 69 // explicit false, but one can compare this value with the various UI
43 // flows that lead to account sign-in, and deduce that the difference 70 // flows that lead to account sign-in, and deduce that the difference
44 // counts the failures. 71 // counts the failures.
45 UMA_HISTOGRAM_BOOLEAN("Signin.AddAccount", true); 72 UMA_HISTOGRAM_BOOLEAN("Signin.AddAccount", true);
46 } 73 }
47 74
48 } // namespace signin_metrics 75 } // namespace signin_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698