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.
18 // Deprecated. Indicates different primary accounts.
19 UNUSED_ACCOUNTS_DIFFERENT
,
20 // No GAIA cookie present, so the primaries are considered different.
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.
29 // The value used within unit tests
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.
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
49 // Keep this as the last enum.
50 NUM_PROFILE_SIGNOUT_METRICS
,
53 // Enum values used for use with "AutoLogin.Reverse" histograms.
55 // The infobar was shown to the user.
57 // The user pressed the accept button to perform the suggested action.
59 // The user pressed the reject to turn off the feature.
61 // The user pressed the X button to dismiss the infobar this time.
63 // The user completely ignored the infoar. Either they navigated away, or
64 // they used the page as is.
66 // The user clicked on the learn more link in the infobar.
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.
81 // Enum values used with the "Signin.OneClickConfirmation" histogram, which
82 // tracks the actions used in the OneClickConfirmation bubble.
84 HISTOGRAM_CONFIRM_SHOWN
,
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
,
101 // Enum valus used with the "Signin.SigninSource" histogram, which tracks the
102 // source that launched a Gaia signin page.
104 SOURCE_START_PAGE
= 0, // This must be first.
108 SOURCE_EXTENSION_INSTALL_BUBBLE
,
110 SOURCE_APPS_PAGE_LINK
,
111 SOURCE_BOOKMARK_BUBBLE
,
112 SOURCE_AVATAR_BUBBLE_SIGN_IN
,
113 SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT
,
116 SOURCE_UNKNOWN
, // This must be last.
119 // Enum values used for use with the "Signin.Reauth" histogram.
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
,
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.
134 // The profile has previously opted out of the promo.
136 // The profile is already 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.
148 // The user has no device that was recently active.
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.
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
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_