| 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", |
| 26 static_cast<int>(access_point), |
| 27 static_cast<int>(AccessPoint::ACCESS_POINT_MAX)); |
| 28 } |
| 29 |
| 30 void LogSigninAccessPointCompleted(AccessPoint access_point) { |
| 31 UMA_HISTOGRAM_ENUMERATION("Signin.SigninCompletedAccessPoint", |
| 32 static_cast<int>(access_point), |
| 33 static_cast<int>(AccessPoint::ACCESS_POINT_MAX)); |
| 34 } |
| 35 |
| 36 void LogSigninReason(Reason reason) { |
| 37 UMA_HISTOGRAM_ENUMERATION("Signin.SigninReason", static_cast<int>(reason), |
| 38 static_cast<int>(Reason::REASON_MAX)); |
| 39 } |
| 40 |
| 24 void LogSigninAccountReconciliation(int total_number_accounts, | 41 void LogSigninAccountReconciliation(int total_number_accounts, |
| 25 int count_added_to_cookie_jar, | 42 int count_added_to_cookie_jar, |
| 26 int count_removed_from_cookie_jar, | 43 int count_removed_from_cookie_jar, |
| 27 bool primary_accounts_same, | 44 bool primary_accounts_same, |
| 28 bool is_first_reconcile, | 45 bool is_first_reconcile, |
| 29 int pre_count_gaia_cookies) { | 46 int pre_count_gaia_cookies) { |
| 30 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfAccountsPerProfile", | 47 UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfAccountsPerProfile", |
| 31 total_number_accounts); | 48 total_number_accounts); |
| 32 // We want to include zeroes in the counts of added or removed accounts to | 49 // We want to include zeroes in the counts of added or removed accounts to |
| 33 // easily capture _relatively_ how often we merge accounts. | 50 // 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. | 83 // Track whether or not the user signed in during the first run of Chrome. |
| 67 UMA_HISTOGRAM_BOOLEAN("Signin.DuringFirstRun", is_first_run); | 84 UMA_HISTOGRAM_BOOLEAN("Signin.DuringFirstRun", is_first_run); |
| 68 | 85 |
| 69 // Determine how much time passed since install when this profile was signed | 86 // Determine how much time passed since install when this profile was signed |
| 70 // in. | 87 // in. |
| 71 base::TimeDelta elapsed_time = base::Time::Now() - install_date; | 88 base::TimeDelta elapsed_time = base::Time::Now() - install_date; |
| 72 UMA_HISTOGRAM_COUNTS("Signin.ElapsedTimeFromInstallToSignin", | 89 UMA_HISTOGRAM_COUNTS("Signin.ElapsedTimeFromInstallToSignin", |
| 73 elapsed_time.InMinutes()); | 90 elapsed_time.InMinutes()); |
| 74 } | 91 } |
| 75 | 92 |
| 76 void LogSigninSource(Source source) { | |
| 77 UMA_HISTOGRAM_ENUMERATION("Signin.SigninSource", source, HISTOGRAM_MAX); | |
| 78 } | |
| 79 | |
| 80 void LogSigninAddAccount() { | 93 void LogSigninAddAccount() { |
| 81 // Account signin may fail for a wide variety of reasons. There is no | 94 // 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 | 95 // 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 | 96 // flows that lead to account sign-in, and deduce that the difference |
| 84 // counts the failures. | 97 // counts the failures. |
| 85 UMA_HISTOGRAM_BOOLEAN("Signin.AddAccount", true); | 98 UMA_HISTOGRAM_BOOLEAN("Signin.AddAccount", true); |
| 86 } | 99 } |
| 87 | 100 |
| 88 void LogSignout(ProfileSignout metric) { | 101 void LogSignout(ProfileSignout metric) { |
| 89 UMA_HISTOGRAM_ENUMERATION("Signin.SignoutProfile", metric, | 102 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, | 147 (base::Time::Now() - previous_activity_time).InMinutes(), 1, |
| 135 base::TimeDelta::FromDays(30).InMinutes(), 50); | 148 base::TimeDelta::FromDays(30).InMinutes(), 50); |
| 136 } | 149 } |
| 137 | 150 |
| 138 void LogAccountReconcilorStateOnGaiaResponse(AccountReconcilorState state) { | 151 void LogAccountReconcilorStateOnGaiaResponse(AccountReconcilorState state) { |
| 139 UMA_HISTOGRAM_ENUMERATION("Signin.AccountReconcilorState.OnGaiaResponse", | 152 UMA_HISTOGRAM_ENUMERATION("Signin.AccountReconcilorState.OnGaiaResponse", |
| 140 state, ACCOUNT_RECONCILOR_HISTOGRAM_COUNT); | 153 state, ACCOUNT_RECONCILOR_HISTOGRAM_COUNT); |
| 141 } | 154 } |
| 142 | 155 |
| 143 } // namespace signin_metrics | 156 } // namespace signin_metrics |
| OLD | NEW |