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

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: logged once 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){};
Ilya Sherman 2015/03/23 20:58:16 nit: Please revert the diff on this line. Also, w
Mathieu 2015/03/23 21:11:28 This is the work of "git cl format" but removing t
528 529
529 void AutofillMetrics::FormEventLogger::OnDidInteractWithAutofillableForm() { 530 void AutofillMetrics::FormEventLogger::OnDidInteractWithAutofillableForm() {
530 if (!has_logged_interacted_) { 531 if (!has_logged_interacted_) {
531 has_logged_interacted_ = true; 532 has_logged_interacted_ = true;
532 Log(AutofillMetrics::FORM_EVENT_INTERACTED_ONCE); 533 Log(AutofillMetrics::FORM_EVENT_INTERACTED_ONCE);
533 } 534 }
534 } 535 }
535 536
536 void AutofillMetrics::FormEventLogger::OnDidShowSuggestions() { 537 void AutofillMetrics::FormEventLogger::OnDidShowSuggestions() {
537 Log(AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN); 538 Log(AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 if (!has_logged_suggestion_filled_) { 591 if (!has_logged_suggestion_filled_) {
591 has_logged_suggestion_filled_ = true; 592 has_logged_suggestion_filled_ = true;
592 logged_suggestion_filled_was_server_data_ = 593 logged_suggestion_filled_was_server_data_ =
593 profile.record_type() == AutofillProfile::SERVER_PROFILE; 594 profile.record_type() == AutofillProfile::SERVER_PROFILE;
594 Log(profile.record_type() == AutofillProfile::SERVER_PROFILE 595 Log(profile.record_type() == AutofillProfile::SERVER_PROFILE
595 ? AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_FILLED_ONCE 596 ? AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_FILLED_ONCE
596 : AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_FILLED_ONCE); 597 : AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_FILLED_ONCE);
597 } 598 }
598 } 599 }
599 600
600 void AutofillMetrics::FormEventLogger::OnDidSubmitForm() { 601 void AutofillMetrics::FormEventLogger::OnWillSubmitForm() {
601 // Not logging this kind of form if we haven't logged a user interaction. 602 // Not logging this kind of form if we haven't logged a user interaction.
602 if (!has_logged_interacted_) 603 if (!has_logged_interacted_)
603 return; 604 return;
605
606 // Not logging twice.
607 if (has_logged_will_submit_)
608 return;
609 has_logged_will_submit_ = true;
610
611 Log(AutofillMetrics::FORM_EVENT_WILL_SUBMIT_ONCE);
Ilya Sherman 2015/03/23 20:58:16 Do we want to split up the WILL_SUBMIT_* metrics t
Mathieu 2015/03/23 21:11:28 Yes some forms will only emit WILL_SUBMIT_ONCE. I
Ilya Sherman 2015/03/23 23:58:17 I defer to Walter and Evan, but it does seem likel
612 }
613
614 void AutofillMetrics::FormEventLogger::OnFormSubmitted() {
615 // Not logging this kind of form if we haven't logged a user interaction.
616 if (!has_logged_interacted_)
617 return;
604 618
605 // Not logging twice. 619 // Not logging twice.
606 if (has_logged_submitted_) 620 if (has_logged_submitted_)
607 return; 621 return;
608 has_logged_submitted_ = true; 622 has_logged_submitted_ = true;
609 623
610 if (!has_logged_suggestion_filled_) { 624 if (!has_logged_suggestion_filled_) {
611 Log(AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE); 625 Log(AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE);
612 } else if (logged_suggestion_filled_was_masked_server_card_) { 626 } else if (logged_suggestion_filled_was_masked_server_card_) {
613 Log(AutofillMetrics 627 Log(AutofillMetrics
(...skipping 22 matching lines...) Expand all
636 else if (is_server_data_available_ && !is_local_data_available_) 650 else if (is_server_data_available_ && !is_local_data_available_)
637 name += ".WithOnlyServerData"; 651 name += ".WithOnlyServerData";
638 else if (!is_server_data_available_ && is_local_data_available_) 652 else if (!is_server_data_available_ && is_local_data_available_)
639 name += ".WithOnlyLocalData"; 653 name += ".WithOnlyLocalData";
640 else 654 else
641 name += ".WithBothServerAndLocalData"; 655 name += ".WithBothServerAndLocalData";
642 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); 656 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS);
643 } 657 }
644 658
645 } // namespace autofill 659 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698