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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 AutofillProfileAction action) { | 574 AutofillProfileAction action) { |
575 UMA_HISTOGRAM_ENUMERATION("Autofill.ProfileActionOnFormSubmitted", action, | 575 UMA_HISTOGRAM_ENUMERATION("Autofill.ProfileActionOnFormSubmitted", action, |
576 AUTOFILL_PROFILE_ACTION_ENUM_SIZE); | 576 AUTOFILL_PROFILE_ACTION_ENUM_SIZE); |
577 } | 577 } |
578 | 578 |
579 // static | 579 // static |
580 void AutofillMetrics::LogAutofillFormSubmittedState( | 580 void AutofillMetrics::LogAutofillFormSubmittedState( |
581 AutofillFormSubmittedState state) { | 581 AutofillFormSubmittedState state) { |
582 UMA_HISTOGRAM_ENUMERATION("Autofill.FormSubmittedState", state, | 582 UMA_HISTOGRAM_ENUMERATION("Autofill.FormSubmittedState", state, |
583 AUTOFILL_FORM_SUBMITTED_STATE_ENUM_SIZE); | 583 AUTOFILL_FORM_SUBMITTED_STATE_ENUM_SIZE); |
| 584 |
| 585 switch (state) { |
| 586 case NON_FILLABLE_FORM_OR_NEW_DATA: |
| 587 base::RecordAction( |
| 588 base::UserMetricsAction("Autofill_FormSubmitted_NonFillable")); |
| 589 break; |
| 590 |
| 591 case FILLABLE_FORM_AUTOFILLED_ALL: |
| 592 base::RecordAction( |
| 593 base::UserMetricsAction("Autofill_FormSubmitted_FilledAll")); |
| 594 break; |
| 595 |
| 596 case FILLABLE_FORM_AUTOFILLED_SOME: |
| 597 base::RecordAction( |
| 598 base::UserMetricsAction("Autofill_FormSubmitted_FilledSome")); |
| 599 break; |
| 600 |
| 601 case FILLABLE_FORM_AUTOFILLED_NONE_DID_SHOW_SUGGESTIONS: |
| 602 base::RecordAction(base::UserMetricsAction( |
| 603 "Autofill_FormSubmitted_FilledNone_SuggestionsShown")); |
| 604 break; |
| 605 |
| 606 case FILLABLE_FORM_AUTOFILLED_NONE_DID_NOT_SHOW_SUGGESTIONS: |
| 607 base::RecordAction(base::UserMetricsAction( |
| 608 "Autofill_FormSubmitted_FilledNone_SuggestionsNotShown")); |
| 609 break; |
| 610 |
| 611 default: |
| 612 NOTREACHED(); |
| 613 break; |
| 614 } |
584 } | 615 } |
585 | 616 |
586 // static | 617 // static |
587 void AutofillMetrics::LogDetermineHeuristicTypesTiming( | 618 void AutofillMetrics::LogDetermineHeuristicTypesTiming( |
588 const base::TimeDelta& duration) { | 619 const base::TimeDelta& duration) { |
589 UMA_HISTOGRAM_TIMES("Autofill.Timing.DetermineHeuristicTypes", duration); | 620 UMA_HISTOGRAM_TIMES("Autofill.Timing.DetermineHeuristicTypes", duration); |
590 } | 621 } |
591 | 622 |
592 // static | 623 // static |
593 void AutofillMetrics::LogParseFormTiming(const base::TimeDelta& duration) { | 624 void AutofillMetrics::LogParseFormTiming(const base::TimeDelta& duration) { |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 if (!has_logged_suggestion_filled_) { | 787 if (!has_logged_suggestion_filled_) { |
757 Log(AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE); | 788 Log(AutofillMetrics::FORM_EVENT_NO_SUGGESTION_SUBMITTED_ONCE); |
758 } else if (logged_suggestion_filled_was_masked_server_card_) { | 789 } else if (logged_suggestion_filled_was_masked_server_card_) { |
759 Log(AutofillMetrics | 790 Log(AutofillMetrics |
760 ::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE); | 791 ::FORM_EVENT_MASKED_SERVER_CARD_SUGGESTION_SUBMITTED_ONCE); |
761 } else if (logged_suggestion_filled_was_server_data_) { | 792 } else if (logged_suggestion_filled_was_server_data_) { |
762 Log(AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE); | 793 Log(AutofillMetrics::FORM_EVENT_SERVER_SUGGESTION_SUBMITTED_ONCE); |
763 } else { | 794 } else { |
764 Log(AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE); | 795 Log(AutofillMetrics::FORM_EVENT_LOCAL_SUGGESTION_SUBMITTED_ONCE); |
765 } | 796 } |
766 | |
767 base::RecordAction(base::UserMetricsAction("Autofill_FormSubmitted")); | |
768 } | 797 } |
769 | 798 |
770 void AutofillMetrics::FormEventLogger::Log(FormEvent event) const { | 799 void AutofillMetrics::FormEventLogger::Log(FormEvent event) const { |
771 DCHECK_LT(event, NUM_FORM_EVENTS); | 800 DCHECK_LT(event, NUM_FORM_EVENTS); |
772 std::string name("Autofill.FormEvents."); | 801 std::string name("Autofill.FormEvents."); |
773 if (is_for_credit_card_) | 802 if (is_for_credit_card_) |
774 name += "CreditCard"; | 803 name += "CreditCard"; |
775 else | 804 else |
776 name += "Address"; | 805 name += "Address"; |
777 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); | 806 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); |
778 | 807 |
779 // Logging again in a different histogram for segmentation purposes. | 808 // Logging again in a different histogram for segmentation purposes. |
780 // TODO(waltercacau): Re-evaluate if we still need such fine grained | 809 // TODO(waltercacau): Re-evaluate if we still need such fine grained |
781 // segmentation. http://crbug.com/454018 | 810 // segmentation. http://crbug.com/454018 |
782 if (!is_server_data_available_ && !is_local_data_available_) | 811 if (!is_server_data_available_ && !is_local_data_available_) |
783 name += ".WithNoData"; | 812 name += ".WithNoData"; |
784 else if (is_server_data_available_ && !is_local_data_available_) | 813 else if (is_server_data_available_ && !is_local_data_available_) |
785 name += ".WithOnlyServerData"; | 814 name += ".WithOnlyServerData"; |
786 else if (!is_server_data_available_ && is_local_data_available_) | 815 else if (!is_server_data_available_ && is_local_data_available_) |
787 name += ".WithOnlyLocalData"; | 816 name += ".WithOnlyLocalData"; |
788 else | 817 else |
789 name += ".WithBothServerAndLocalData"; | 818 name += ".WithBothServerAndLocalData"; |
790 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); | 819 LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS); |
791 } | 820 } |
792 | 821 |
793 } // namespace autofill | 822 } // namespace autofill |
OLD | NEW |