signin_metrics.cc revision cedac228d2dd51db4b79ea1e72c7f249408ee061
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.
4
5#include "components/signin/core/browser/signin_metrics.h"
6
7#include "base/logging.h"
8#include "base/metrics/histogram.h"
9#include "base/metrics/user_metrics.h"
10
11namespace signin_metrics {
12
13void LogSigninAccountReconciliation(int total_number_accounts,
14                                    int count_added_to_cookie_jar,
15                                    int count_added_to_token,
16                                    bool primary_accounts_same,
17                                    bool is_first_reconcile) {
18  UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfAccountsPerProfile",
19                           total_number_accounts);
20  // We want to include zeroes in the counts of added accounts to easily
21  // capture _relatively_ how often we merge accounts.
22  if (is_first_reconcile) {
23    UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToCookieJar.FirstRun",
24                             count_added_to_cookie_jar);
25    UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToChrome.FirstRun",
26                             count_added_to_token);
27    UMA_HISTOGRAM_BOOLEAN("Signin.Reconciler.DifferentPrimaryAccounts.FirstRun",
28                          !primary_accounts_same);
29  } else {
30    UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToCookieJar.SubsequentRun",
31                             count_added_to_cookie_jar);
32    UMA_HISTOGRAM_COUNTS_100("Signin.Reconciler.AddedToChrome.SubsequentRun",
33                             count_added_to_token);
34    UMA_HISTOGRAM_BOOLEAN(
35        "Signin.Reconciler.DifferentPrimaryAccounts.SubsequentRun",
36        !primary_accounts_same);
37  }
38}
39
40void LogSigninAddAccount() {
41  // 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
43  // flows that lead to account sign-in, and deduce that the difference
44  // counts the failures.
45  UMA_HISTOGRAM_BOOLEAN("Signin.AddAccount", true);
46}
47
48}  // namespace signin_metrics
49