OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/autofill/core/browser/autofill_metrics.h" | 5 #include "components/autofill/core/browser/autofill_metrics.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 // static | 458 // static |
459 void AutofillMetrics::LogStoredProfileCount(size_t num_profiles) { | 459 void AutofillMetrics::LogStoredProfileCount(size_t num_profiles) { |
460 UMA_HISTOGRAM_COUNTS("Autofill.StoredProfileCount", num_profiles); | 460 UMA_HISTOGRAM_COUNTS("Autofill.StoredProfileCount", num_profiles); |
461 } | 461 } |
462 | 462 |
463 // static | 463 // static |
464 void AutofillMetrics::LogAddressSuggestionsCount(size_t num_suggestions) { | 464 void AutofillMetrics::LogAddressSuggestionsCount(size_t num_suggestions) { |
465 UMA_HISTOGRAM_COUNTS("Autofill.AddressSuggestionsCount", num_suggestions); | 465 UMA_HISTOGRAM_COUNTS("Autofill.AddressSuggestionsCount", num_suggestions); |
466 } | 466 } |
467 | 467 |
| 468 AutofillMetrics::FormEventLogger::FormEventLogger(bool is_credit_card) |
| 469 : is_credit_card_(is_credit_card), |
| 470 is_server_data_available_(false), |
| 471 is_local_data_available_(false), |
| 472 has_logged_interacted_(false) {}; |
| 473 |
| 474 void AutofillMetrics::FormEventLogger::set_is_server_data_available( |
| 475 bool is_server_data_available) { |
| 476 is_server_data_available_ = is_server_data_available; |
| 477 } |
| 478 |
| 479 void AutofillMetrics::FormEventLogger::set_is_local_data_available( |
| 480 bool is_local_data_available) { |
| 481 is_local_data_available_ = is_local_data_available; |
| 482 } |
| 483 |
| 484 void AutofillMetrics::FormEventLogger::OnDidInteractWithAutofillableForm() { |
| 485 if (!has_logged_interacted_) { |
| 486 has_logged_interacted_ = true; |
| 487 Log(AutofillMetrics::INTERACTED_ONCE_FORM_EVENT); |
| 488 } |
| 489 } |
| 490 |
| 491 void AutofillMetrics::FormEventLogger::Log(AutofillFormEvent event) const { |
| 492 DCHECK_LT(event, NUM_AUTOFILL_FORM_EVENTS); |
| 493 std::string name("Autofill.FormEvents."); |
| 494 if (is_credit_card_) { |
| 495 name += "CreditCard"; |
| 496 } else { |
| 497 name += "Address"; |
| 498 } |
| 499 LogUMAHistogramEnumeration(name, event, NUM_AUTOFILL_FORM_EVENTS); |
| 500 |
| 501 // Logging again in a different histogram for segmentation purposes. |
| 502 // TODO(waltercacau): Re-evaluate if we still need such fine grained |
| 503 // segmentation. http://crbug.com/454018 |
| 504 if (!is_server_data_available_ && !is_local_data_available_) { |
| 505 name += ".WithNoData"; |
| 506 } else if (is_server_data_available_ && !is_local_data_available_) { |
| 507 name += ".WithOnlyServerData"; |
| 508 } else if (!is_server_data_available_ && is_local_data_available_) { |
| 509 name += ".WithOnlyLocalData"; |
| 510 } else { |
| 511 name += ".WithBothServerAndLocalData"; |
| 512 } |
| 513 LogUMAHistogramEnumeration(name, event, NUM_AUTOFILL_FORM_EVENTS); |
| 514 } |
| 515 |
468 } // namespace autofill | 516 } // namespace autofill |
OLD | NEW |