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

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

Issue 1010263002: [Autofill] Add FormEvent logging for "will submit form". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split Created 5 years, 9 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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 } 515 }
516 516
517 AutofillMetrics::FormEventLogger::FormEventLogger(bool is_for_credit_card) 517 AutofillMetrics::FormEventLogger::FormEventLogger(bool is_for_credit_card)
518 : is_for_credit_card_(is_for_credit_card), 518 : is_for_credit_card_(is_for_credit_card),
519 is_server_data_available_(false), 519 is_server_data_available_(false),
520 is_local_data_available_(false), 520 is_local_data_available_(false),
521 has_logged_interacted_(false), 521 has_logged_interacted_(false),
522 has_logged_suggestions_shown_(false), 522 has_logged_suggestions_shown_(false),
523 has_logged_masked_server_card_suggestion_selected_(false), 523 has_logged_masked_server_card_suggestion_selected_(false),
524 has_logged_suggestion_filled_(false), 524 has_logged_suggestion_filled_(false),
525 has_logged_will_submit_(false),
525 has_logged_submitted_(false), 526 has_logged_submitted_(false),
526 logged_suggestion_filled_was_server_data_(false), 527 logged_suggestion_filled_was_server_data_(false),
527 logged_suggestion_filled_was_masked_server_card_(false) {}; 528 logged_suggestion_filled_was_masked_server_card_(false) {
529 }
528 530
529 void AutofillMetrics::FormEventLogger::OnDidInteractWithAutofillableForm() { 531 void AutofillMetrics::FormEventLogger::OnDidInteractWithAutofillableForm() {
530 if (!has_logged_interacted_) { 532 if (!has_logged_interacted_) {
531 has_logged_interacted_ = true; 533 has_logged_interacted_ = true;
532 Log(AutofillMetrics::FORM_EVENT_INTERACTED_ONCE); 534 Log(AutofillMetrics::FORM_EVENT_INTERACTED_ONCE);
533 } 535 }
534 } 536 }
535 537
536 void AutofillMetrics::FormEventLogger::OnDidShowSuggestions() { 538 void AutofillMetrics::FormEventLogger::OnDidShowSuggestions() {
537 Log(AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN); 539 Log(AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 if (!has_logged_suggestion_filled_) { 592 if (!has_logged_suggestion_filled_) {
591 has_logged_suggestion_filled_ = true; 593 has_logged_suggestion_filled_ = true;
592 logged_suggestion_filled_was_server_data_ = 594 logged_suggestion_filled_was_server_data_ =
593 profile.record_type() == AutofillProfile::SERVER_PROFILE; 595 profile.record_type() == AutofillProfile::SERVER_PROFILE;
594 Log(profile.record_type() == AutofillProfile::SERVER_PROFILE 596 Log(profile.record_type() == AutofillProfile::SERVER_PROFILE
595 ? AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_FILLED_ONCE 597 ? AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_FILLED_ONCE
596 : AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_FILLED_ONCE); 598 : AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_FILLED_ONCE);
597 } 599 }
598 } 600 }
599 601
600 void AutofillMetrics::FormEventLogger::OnDidSubmitForm() { 602 void AutofillMetrics::FormEventLogger::OnWillSubmitForm() {
601 // Not logging this kind of form if we haven't logged a user interaction. 603 // Not logging this kind of form if we haven't logged a user interaction.
602 if (!has_logged_interacted_) 604 if (!has_logged_interacted_)
603 return; 605 return;
606
607 // Not logging twice.
608 if (has_logged_will_submit_)
609 return;
610 has_logged_will_submit_ = true;
611
612 if (!has_logged_suggestion_filled_) {
613 Log(AutofillMetrics::FORM_EVENT_NO_SUGGESTION_WILL_SUBMIT_ONCE);
614 } else if (logged_suggestion_filled_was_masked_server_card_) {
615 Log(AutofillMetrics::
616 FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_WILL_SUBMIT_ONCE);
617 } else if (logged_suggestion_filled_was_server_data_) {
618 Log(AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_WILL_SUBMIT_ONCE);
619 } else {
620 Log(AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_WILL_SUBMIT_ONCE);
621 }
622 }
623
624 void AutofillMetrics::FormEventLogger::OnFormSubmitted() {
625 // Not logging this kind of form if we haven't logged a user interaction.
626 if (!has_logged_interacted_)
627 return;
604 628
605 // Not logging twice. 629 // Not logging twice.
606 if (has_logged_submitted_) 630 if (has_logged_submitted_)
607 return; 631 return;
608 has_logged_submitted_ = true; 632 has_logged_submitted_ = true;
609 633
610 if (!has_logged_suggestion_filled_) { 634 if (!has_logged_suggestion_filled_) {
611 Log(AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE); 635 Log(AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE);
612 } else if (logged_suggestion_filled_was_masked_server_card_) { 636 } else if (logged_suggestion_filled_was_masked_server_card_) {
613 Log(AutofillMetrics 637 Log(AutofillMetrics
(...skipping 22 matching lines...) Expand all
636 else if (is_server_data_available_ && !is_local_data_available_) 660 else if (is_server_data_available_ && !is_local_data_available_)
637 name += ".WithOnlyServerData"; 661 name += ".WithOnlyServerData";
638 else if (!is_server_data_available_ && is_local_data_available_) 662 else if (!is_server_data_available_ && is_local_data_available_)
639 name += ".WithOnlyLocalData"; 663 name += ".WithOnlyLocalData";
640 else 664 else
641 name += ".WithBothServerAndLocalData"; 665 name += ".WithBothServerAndLocalData";
642 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); 666 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS);
643 } 667 }
644 668
645 } // namespace autofill 669 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_metrics.h ('k') | components/autofill/core/browser/autofill_metrics_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698