| OLD | NEW |
| 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_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/metrics/user_metrics.h" | 9 #include "base/metrics/user_metrics.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 | 11 |
| 12 namespace signin_metrics { | 12 namespace signin_metrics { |
| 13 | 13 |
| 14 // Helper method to determine which |DifferentPrimaryAccounts| applies. | 14 // Helper method to determine which |DifferentPrimaryAccounts| applies. |
| 15 DifferentPrimaryAccounts ComparePrimaryAccounts(bool primary_accounts_same, | 15 DifferentPrimaryAccounts ComparePrimaryAccounts(bool primary_accounts_same, |
| 16 int pre_count_gaia_cookies) { | 16 int pre_count_gaia_cookies) { |
| 17 if (primary_accounts_same) | 17 if (primary_accounts_same) |
| 18 return ACCOUNTS_SAME; | 18 return ACCOUNTS_SAME; |
| 19 if (pre_count_gaia_cookies == 0) | 19 if (pre_count_gaia_cookies == 0) |
| 20 return NO_COOKIE_PRESENT; | 20 return NO_COOKIE_PRESENT; |
| 21 return COOKIE_AND_TOKEN_PRIMARIES_DIFFERENT; | 21 return COOKIE_AND_TOKEN_PRIMARIES_DIFFERENT; |
| 22 } | 22 } |
| 23 | 23 |
| 24 void LogSigninAccessPointStarted(AccessPoint access_point) { |
| 25 UMA_HISTOGRAM_ENUMERATION("Signin.SigninStartedAccessPoint", access_point, |
| 26 ACCESS_POINT_MAX); |
| 27 } |
| 28 |
| 29 void LogSigninAccessPointCompleted(AccessPoint access_point) { |
| 30 UMA_HISTOGRAM_ENUMERATION("Signin.SigninCompletedAccessPoint", access_point, |
| 31 ACCESS_POINT_MAX); |
| 32 } |
| 33 |
| 34 void LogSigninReason(Reason reason) { |
| 35 UMA_HISTOGRAM_ENUMERATION("Signin.SigninReason", reason, REASON_MAX); |
| 36 } |
| 37 |
| 24 void LogSigninAccountReconciliation(int total_number_accounts, | 38 void LogSigninAccountReconciliation(int total_number_accounts, |
| 25 int count_added_to_cookie_jar, | 39 int count_added_to_cookie_jar, |
| 26 int count_removed_from_cookie_jar, | 40 int count_removed_from_cookie_jar, |
| 27 bool primary_accounts_same, | 41 bool primary_accounts_same, |
| 28 bool is_first_reconcile, | 42 bool is_first_reconcile, |
| 29 int pre_count_gaia_cookies) { | 43 int pre_count_gaia_cookies) { |
| 30 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfAccountsPerProfile", | 44 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfAccountsPerProfile", |
| 31 total_number_accounts); | 45 total_number_accounts); |
| 32 // We want to include zeroes in the counts of added or removed accounts to | 46 // We want to include zeroes in the counts of added or removed accounts to |
| 33 // easily capture _relatively_ how often we merge accounts. | 47 // easily capture _relatively_ how often we merge accounts. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // Track whether or not the user signed in during the first run of Chrome. | 80 // Track whether or not the user signed in during the first run of Chrome. |
| 67 UMA_HISTOGRAM_BOOLEAN("Signin.DuringFirstRun", is_first_run); | 81 UMA_HISTOGRAM_BOOLEAN("Signin.DuringFirstRun", is_first_run); |
| 68 | 82 |
| 69 // Determine how much time passed since install when this profile was signed | 83 // Determine how much time passed since install when this profile was signed |
| 70 // in. | 84 // in. |
| 71 base::TimeDelta elapsed_time = base::Time::Now() - install_date; | 85 base::TimeDelta elapsed_time = base::Time::Now() - install_date; |
| 72 UMA_HISTOGRAM_COUNTS("Signin.ElapsedTimeFromInstallToSignin", | 86 UMA_HISTOGRAM_COUNTS("Signin.ElapsedTimeFromInstallToSignin", |
| 73 elapsed_time.InMinutes()); | 87 elapsed_time.InMinutes()); |
| 74 } | 88 } |
| 75 | 89 |
| 76 void LogSigninSource(Source source) { | |
| 77 UMA_HISTOGRAM_ENUMERATION("Signin.SigninSource", source, HISTOGRAM_MAX); | |
| 78 } | |
| 79 | |
| 80 void LogSigninAddAccount() { | 90 void LogSigninAddAccount() { |
| 81 // Account signin may fail for a wide variety of reasons. There is no | 91 // Account signin may fail for a wide variety of reasons. There is no |
| 82 // explicit false, but one can compare this value with the various UI | 92 // explicit false, but one can compare this value with the various UI |
| 83 // flows that lead to account sign-in, and deduce that the difference | 93 // flows that lead to account sign-in, and deduce that the difference |
| 84 // counts the failures. | 94 // counts the failures. |
| 85 UMA_HISTOGRAM_BOOLEAN("Signin.AddAccount", true); | 95 UMA_HISTOGRAM_BOOLEAN("Signin.AddAccount", true); |
| 86 } | 96 } |
| 87 | 97 |
| 88 void LogSignout(ProfileSignout metric) { | 98 void LogSignout(ProfileSignout metric) { |
| 89 UMA_HISTOGRAM_ENUMERATION("Signin.SignoutProfile", metric, | 99 UMA_HISTOGRAM_ENUMERATION("Signin.SignoutProfile", metric, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 (base::Time::Now() - previous_activity_time).InMinutes(), 1, | 144 (base::Time::Now() - previous_activity_time).InMinutes(), 1, |
| 135 base::TimeDelta::FromDays(30).InMinutes(), 50); | 145 base::TimeDelta::FromDays(30).InMinutes(), 50); |
| 136 } | 146 } |
| 137 | 147 |
| 138 void LogAccountReconcilorStateOnGaiaResponse(AccountReconcilorState state) { | 148 void LogAccountReconcilorStateOnGaiaResponse(AccountReconcilorState state) { |
| 139 UMA_HISTOGRAM_ENUMERATION("Signin.AccountReconcilorState.OnGaiaResponse", | 149 UMA_HISTOGRAM_ENUMERATION("Signin.AccountReconcilorState.OnGaiaResponse", |
| 140 state, ACCOUNT_RECONCILOR_HISTOGRAM_COUNT); | 150 state, ACCOUNT_RECONCILOR_HISTOGRAM_COUNT); |
| 141 } | 151 } |
| 142 | 152 |
| 143 } // namespace signin_metrics | 153 } // namespace signin_metrics |
| OLD | NEW |