Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: components/autofill/core/browser/autofill_metrics.cc

Issue 884843002: Recording in UMA when a user interacted with an address form or a credit card form. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixing setter Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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);
488 }
489 }
490
491 void AutofillMetrics::FormEventLogger::Log(AutofillFormEvent event) const {
492 DCHECK_LT(event, NUM_AUTOFILL_FORM_EVENTS);
493 if (is_credit_card_) {
494 UMA_HISTOGRAM_ENUMERATION("Autofill.FormEvents.CreditCard", event,
495 NUM_AUTOFILL_FORM_EVENTS);
496 } else {
497 UMA_HISTOGRAM_ENUMERATION("Autofill.FormEvents.Address", event,
498 NUM_AUTOFILL_FORM_EVENTS);
499 }
500
501 // Logging again in a different histogram for segmentation purposes.
502 if (!is_server_data_available_ && !is_local_data_available_) {
503 if (is_credit_card_) {
504 UMA_HISTOGRAM_ENUMERATION(
505 "Autofill.FormEvents.CreditCard.WithNoData",
506 event, NUM_AUTOFILL_FORM_EVENTS);
507 } else {
508 UMA_HISTOGRAM_ENUMERATION(
509 "Autofill.FormEvents.Address.WithNoData",
510 event, NUM_AUTOFILL_FORM_EVENTS);
511 }
512 } else if (is_server_data_available_ && !is_local_data_available_) {
513 if (is_credit_card_) {
514 UMA_HISTOGRAM_ENUMERATION(
515 "Autofill.FormEvents.CreditCard.WithOnlyServerData",
516 event, NUM_AUTOFILL_FORM_EVENTS);
517 } else {
518 UMA_HISTOGRAM_ENUMERATION(
519 "Autofill.FormEvents.Address.WithOnlyServerData",
520 event, NUM_AUTOFILL_FORM_EVENTS);
521 }
522 } else if (!is_server_data_available_ && is_local_data_available_) {
523 if (is_credit_card_) {
524 UMA_HISTOGRAM_ENUMERATION(
525 "Autofill.FormEvents.CreditCard.WithOnlyLocalData",
526 event, NUM_AUTOFILL_FORM_EVENTS);
527 } else {
528 UMA_HISTOGRAM_ENUMERATION(
529 "Autofill.FormEvents.Address.WithOnlyLocalData",
530 event, NUM_AUTOFILL_FORM_EVENTS);
531 }
532 } else {
533 if (is_credit_card_) {
534 UMA_HISTOGRAM_ENUMERATION(
535 "Autofill.FormEvents.CreditCard.WithBothServerAndLocalData",
536 event, NUM_AUTOFILL_FORM_EVENTS);
537 } else {
538 UMA_HISTOGRAM_ENUMERATION(
539 "Autofill.FormEvents.Address.WithBothServerAndLocalData",
540 event, NUM_AUTOFILL_FORM_EVENTS);
541 }
542 }
543 }
544
468 } // namespace autofill 545 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698