Roll src/third_party/WebKit 9f7fb92:f103b33 (svn 202621:202622)
[chromium-blink-merge.git] / components / signin / core / browser / signin_metrics.h
blob9c6ecda5f26a571c089c85e6ca9dff2f0eef8e30
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_METRICS_H_
6 #define COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_METRICS_H_
8 #include "base/time/time.h"
10 #include "google_apis/gaia/google_service_auth_error.h"
12 namespace signin_metrics {
14 // Enum for the ways in which primary account detection is done.
15 enum DifferentPrimaryAccounts {
16 // token and cookie had same primary accounts.
17 ACCOUNTS_SAME = 0,
18 // Deprecated. Indicates different primary accounts.
19 UNUSED_ACCOUNTS_DIFFERENT,
20 // No GAIA cookie present, so the primaries are considered different.
21 NO_COOKIE_PRESENT,
22 // There was at least one cookie and one token, and the primaries differed.
23 COOKIE_AND_TOKEN_PRIMARIES_DIFFERENT,
24 NUM_DIFFERENT_PRIMARY_ACCOUNT_METRICS,
27 // Track all the ways a profile can become signed out as a histogram.
28 enum ProfileSignout {
29 // The value used within unit tests
30 SIGNOUT_TEST = 0,
31 // The preference or policy controlling if signin is valid has changed.
32 SIGNOUT_PREF_CHANGED = 0,
33 // The valid pattern for signing in to the Google service changed.
34 GOOGLE_SERVICE_NAME_PATTERN_CHANGED,
35 // The preference or policy controlling if signin is valid changed during
36 // the signin process.
37 SIGNIN_PREF_CHANGED_DURING_SIGNIN,
38 // User clicked to signout from the settings page.
39 USER_CLICKED_SIGNOUT_SETTINGS,
40 // The signin process was aborted, but signin had succeeded, so signout. This
41 // may be due to a server response, policy definition or user action.
42 ABORT_SIGNIN,
43 // The sync server caused the profile to be signed out.
44 SERVER_FORCED_DISABLE,
45 // The credentials are being transfered to a new profile, so the old one is
46 // signed out.
47 TRANSFER_CREDENTIALS,
49 // Keep this as the last enum.
50 NUM_PROFILE_SIGNOUT_METRICS,
53 // Enum values used for use with "AutoLogin.Reverse" histograms.
54 enum {
55 // The infobar was shown to the user.
56 HISTOGRAM_SHOWN,
57 // The user pressed the accept button to perform the suggested action.
58 HISTOGRAM_ACCEPTED,
59 // The user pressed the reject to turn off the feature.
60 HISTOGRAM_REJECTED,
61 // The user pressed the X button to dismiss the infobar this time.
62 HISTOGRAM_DISMISSED,
63 // The user completely ignored the infoar. Either they navigated away, or
64 // they used the page as is.
65 HISTOGRAM_IGNORED,
66 // The user clicked on the learn more link in the infobar.
67 HISTOGRAM_LEARN_MORE,
68 // The sync was started with default settings.
69 HISTOGRAM_WITH_DEFAULTS,
70 // The sync was started with advanced settings.
71 HISTOGRAM_WITH_ADVANCED,
72 // The sync was started through auto-accept with default settings.
73 HISTOGRAM_AUTO_WITH_DEFAULTS,
74 // The sync was started through auto-accept with advanced settings.
75 HISTOGRAM_AUTO_WITH_ADVANCED,
76 // The sync was aborted with an undo button.
77 HISTOGRAM_UNDO,
78 HISTOGRAM_MAX
81 // Enum values used with the "Signin.OneClickConfirmation" histogram, which
82 // tracks the actions used in the OneClickConfirmation bubble.
83 enum {
84 HISTOGRAM_CONFIRM_SHOWN,
85 HISTOGRAM_CONFIRM_OK,
86 HISTOGRAM_CONFIRM_RETURN,
87 HISTOGRAM_CONFIRM_ADVANCED,
88 HISTOGRAM_CONFIRM_CLOSE,
89 HISTOGRAM_CONFIRM_ESCAPE,
90 HISTOGRAM_CONFIRM_UNDO,
91 HISTOGRAM_CONFIRM_LEARN_MORE,
92 HISTOGRAM_CONFIRM_LEARN_MORE_OK,
93 HISTOGRAM_CONFIRM_LEARN_MORE_RETURN,
94 HISTOGRAM_CONFIRM_LEARN_MORE_ADVANCED,
95 HISTOGRAM_CONFIRM_LEARN_MORE_CLOSE,
96 HISTOGRAM_CONFIRM_LEARN_MORE_ESCAPE,
97 HISTOGRAM_CONFIRM_LEARN_MORE_UNDO,
98 HISTOGRAM_CONFIRM_MAX
101 // Enum valus used with the "Signin.SigninSource" histogram, which tracks the
102 // source that launched a Gaia signin page.
103 enum Source {
104 SOURCE_START_PAGE = 0, // This must be first.
105 SOURCE_NTP_LINK,
106 SOURCE_MENU,
107 SOURCE_SETTINGS,
108 SOURCE_EXTENSION_INSTALL_BUBBLE,
109 SOURCE_APP_LAUNCHER,
110 SOURCE_APPS_PAGE_LINK,
111 SOURCE_BOOKMARK_BUBBLE,
112 SOURCE_AVATAR_BUBBLE_SIGN_IN,
113 SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT,
114 SOURCE_DEVICES_PAGE,
115 SOURCE_REAUTH,
116 SOURCE_UNKNOWN, // This must be last.
119 // Enum values used for use with the "Signin.Reauth" histogram.
120 enum AccountReauth {
121 // The user gave the wrong email when doing a reauthentication.
122 HISTOGRAM_ACCOUNT_MISSMATCH,
123 // The user was shown a reauthentication login screen.
124 HISTOGRAM_REAUTH_SHOWN,
126 HISTOGRAM_REAUTH_MAX
129 // Enum values used for "Signin.XDevicePromo.Eligible" histogram, which tracks
130 // the reasons for which a profile is or is not eligible for the promo.
131 enum CrossDevicePromoEligibility {
132 // The user is eligible for the promo.
133 ELIGIBLE,
134 // The profile has previously opted out of the promo.
135 OPTED_OUT,
136 // The profile is already signed in.
137 SIGNED_IN,
138 // The profile does not have a single, peristent GAIA cookie.
139 NOT_SINGLE_GAIA_ACCOUNT,
140 // Yet to determine how many devices the user has.
141 UNKNOWN_COUNT_DEVICES,
142 // An error was returned trying to determine the account's devices.
143 ERROR_FETCHING_DEVICE_ACTIVITY,
144 // The call to get device activity was throttled, and never executed.
145 THROTTLED_FETCHING_DEVICE_ACTIVITY,
146 // The user has no devices.
147 ZERO_DEVICES,
148 // The user has no device that was recently active.
149 NO_ACTIVE_DEVICES,
150 // Always last enumerated type.
151 NUM_CROSS_DEVICE_PROMO_ELIGIBILITY_METRICS
154 // Enum reasons the CrossDevicePromo couldn't initialize, or that it succeeded.
155 enum CrossDevicePromoInitialized {
156 // The promo was initialized successfully.
157 INITIALIZED,
158 // The profile is opted out, so the promo didn't initialize.
159 UNINITIALIZED_OPTED_OUT,
160 // Unable to read the variations configuration.
161 NO_VARIATIONS_CONFIG,
162 // Always the last enumerated type.
163 NUM_CROSS_DEVICE_PROMO_INITIALIZED_METRICS
166 // Enum values used for "Signin.AccountReconcilorState.OnGaiaResponse"
167 // histogram, which records the state of the AccountReconcilor when GAIA returns
168 // a specific response.
169 enum AccountReconcilorState {
170 // The AccountReconcilor has finished running ans is up-to-date.
171 ACCOUNT_RECONCILOR_OK,
172 // The AccountReconcilor is running and gathering information.
173 ACCOUNT_RECONCILOR_RUNNING,
174 // The AccountReconcilor encountered an error and stopped.
175 ACCOUNT_RECONCILOR_ERROR,
176 // Always the last enumerated type.
177 ACCOUNT_RECONCILOR_HISTOGRAM_COUNT,
180 // Log to UMA histograms and UserCounts stats about a single execution of the
181 // AccountReconciler.
182 // |total_number_accounts| - How many accounts are in the browser for this
183 // profile.
184 // |count_added_to_cookie_jar| - How many accounts were in the browser but not
185 // in the cookie jar.
186 // |count_removed_from_cookie_jar| - How many accounts were in the cookie jar
187 // but not in the browser.
188 // |primary_accounts_same| - False if the primary account for the cookie jar
189 // and the token service were different; else true.
190 // |is_first_reconcile| - True if these stats are from the first execution of
191 // the AccountReconcilor.
192 // |pre_count_gaia_cookies| - How many GAIA cookies were present before
193 // the AccountReconcilor began modifying the state.
194 void LogSigninAccountReconciliation(int total_number_accounts,
195 int count_added_to_cookie_jar,
196 int count_removed_from_cookie_jar,
197 bool primary_accounts_same,
198 bool is_first_reconcile,
199 int pre_count_gaia_cookies);
201 // Track a successful signin.
202 void LogSigninAddAccount();
204 // Tracks the original source that showed the signin page.
205 void LogSigninSource(Source source);
207 // Track a successful signin of a profile.
208 void LogSigninProfile(bool is_first_run, base::Time install_date);
210 // Track a profile signout.
211 void LogSignout(ProfileSignout metric);
213 // Tracks whether the external connection results were all fetched before
214 // the gaia cookie manager service tried to use them with merge session.
215 // |time_to_check_connections| is the time it took to complete.
216 void LogExternalCcResultFetches(
217 bool fetches_completed,
218 const base::TimeDelta& time_to_check_connections);
220 // Track when the current authentication error changed.
221 void LogAuthError(GoogleServiceAuthError::State auth_error);
223 void LogSigninConfirmHistogramValue(int action);
225 void LogXDevicePromoEligible(CrossDevicePromoEligibility metric);
227 void LogXDevicePromoInitialized(CrossDevicePromoInitialized metric);
229 void LogBrowsingSessionDuration(const base::Time& previous_activity_time);
231 // Records the AccountReconcilor |state| when GAIA returns a specific response.
232 // If |state| is different than ACCOUNT_RECONCILOR_OK it means the user will
233 // be shown a different set of accounts in the content-area and the settings UI.
234 void LogAccountReconcilorStateOnGaiaResponse(AccountReconcilorState state);
236 } // namespace signin_metrics
238 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_SIGNIN_METRICS_H_