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

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

Issue 2849753002: Logs all reasons card upload was not offered in UKM and UMA. (Closed)
Patch Set: Formatting fix. Created 3 years, 7 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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 FILLABLE_FORM_AUTOFILLED_ALL, 90 FILLABLE_FORM_AUTOFILLED_ALL,
91 FILLABLE_FORM_AUTOFILLED_SOME, 91 FILLABLE_FORM_AUTOFILLED_SOME,
92 FILLABLE_FORM_AUTOFILLED_NONE_DID_SHOW_SUGGESTIONS, 92 FILLABLE_FORM_AUTOFILLED_NONE_DID_SHOW_SUGGESTIONS,
93 FILLABLE_FORM_AUTOFILLED_NONE_DID_NOT_SHOW_SUGGESTIONS, 93 FILLABLE_FORM_AUTOFILLED_NONE_DID_NOT_SHOW_SUGGESTIONS,
94 AUTOFILL_FORM_SUBMITTED_STATE_ENUM_SIZE, 94 AUTOFILL_FORM_SUBMITTED_STATE_ENUM_SIZE,
95 }; 95 };
96 96
97 enum CardUploadDecisionMetric { 97 enum CardUploadDecisionMetric {
98 // All the required conditions were satisfied and the card upload prompt was 98 // All the required conditions were satisfied and the card upload prompt was
99 // triggered. 99 // triggered.
100 UPLOAD_OFFERED, 100 UPLOAD_OFFERED = 1 << 0,
101 // No CVC was detected. We don't know whether any addresses were available 101 // No CVC was detected. We don't know whether any addresses were available
102 // nor whether we would have been able to get upload details. 102 // nor whether we would have been able to get upload details.
103 UPLOAD_NOT_OFFERED_NO_CVC, 103 UPLOAD_NOT_OFFERED_NO_CVC = 1 << 1,
104 // A CVC was detected but no recently created or used address was available. 104 // A CVC was detected but no recently created or used address was available.
105 // We don't know whether we would have been able to get upload details. 105 // We don't know whether we would have been able to get upload details.
106 UPLOAD_NOT_OFFERED_NO_ADDRESS, 106 UPLOAD_NOT_OFFERED_NO_ADDRESS = 1 << 2,
Steven Holte 2017/05/02 23:50:29 What about the UPLOAD_NOT_OFFERED part of UPLOAD_N
csashi 2017/05/02 23:54:43 I don't follow this comment. We log this bit if th
Steven Holte 2017/05/03 01:04:05 For logging this to UKM, it seems like the bit is
csashi 2017/05/03 01:20:41 Unfortunately, not setting UPLOAD_OFFERED does not
107 // A CVC and one or more addresses were available but no name was found on 107 // A CVC and one or more addresses were available but no name was found on
108 // either the card or the adress(es). We don't know whether the address(es) 108 // either the card or the adress(es). We don't know whether the address(es)
109 // were otherwise valid nor whether we would have been able to get upload 109 // were otherwise valid nor whether we would have been able to get upload
110 // details. 110 // details.
111 UPLOAD_NOT_OFFERED_NO_NAME, 111 UPLOAD_NOT_OFFERED_NO_NAME = 1 << 3,
112 // A CVC, multiple addresses, and a name were available but the adresses had 112 // A CVC, multiple addresses, and a name were available but the adresses had
113 // conflicting zip codes. We don't know whether we would have been able to 113 // conflicting zip codes. We don't know whether we would have been able to
114 // get upload details. 114 // get upload details.
115 UPLOAD_NOT_OFFERED_CONFLICTING_ZIPS, 115 UPLOAD_NOT_OFFERED_CONFLICTING_ZIPS = 1 << 4,
116 // A CVC, one or more addresses, and a name were available but no zip code 116 // A CVC, one or more addresses, and a name were available but no zip code
117 // was found on any of the adress(es). We don't know whether we would have 117 // was found on any of the adress(es). We don't know whether we would have
118 // been able to get upload details. 118 // been able to get upload details.
119 UPLOAD_NOT_OFFERED_NO_ZIP_CODE, 119 UPLOAD_NOT_OFFERED_NO_ZIP_CODE = 1 << 5,
120 // A CVC, one or more valid addresses, and a name were available but the 120 // A CVC, one or more valid addresses, and a name were available but the
121 // request to Payments for upload details failed. 121 // request to Payments for upload details failed.
122 UPLOAD_NOT_OFFERED_GET_UPLOAD_DETAILS_FAILED, 122 UPLOAD_NOT_OFFERED_GET_UPLOAD_DETAILS_FAILED = 1 << 6,
123 // A CVC and one or more addresses were available but the names on the card 123 // A CVC and one or more addresses were available but the names on the card
124 // and/or the addresses didn't match. We don't know whether the address(es) 124 // and/or the addresses didn't match. We don't know whether the address(es)
125 // were otherwise valid nor whether we would have been able to get upload 125 // were otherwise valid nor whether we would have been able to get upload
126 // details. 126 // details.
127 UPLOAD_NOT_OFFERED_CONFLICTING_NAMES, 127 UPLOAD_NOT_OFFERED_CONFLICTING_NAMES = 1 << 7,
128 // No CVC was detected, but valid addresses and names were. Upload is still 128 // No CVC was detected, but valid addresses and names were. Upload is still
129 // possible if the user manually enters CVC, so upload was offered. 129 // possible if the user manually enters CVC, so upload was offered.
130 UPLOAD_OFFERED_NO_CVC, 130 UPLOAD_OFFERED_NO_CVC = 1 << 8,
131 NUM_CARD_UPLOAD_DECISION_METRICS, 131 // Update |kNumCardUploadDecisionMetrics| when adding new enum here.
132 }; 132 };
133 133
134 enum DeveloperEngagementMetric { 134 enum DeveloperEngagementMetric {
135 // Parsed a form that is potentially autofillable and does not contain any 135 // Parsed a form that is potentially autofillable and does not contain any
136 // web developer-specified field type hint. 136 // web developer-specified field type hint.
137 FILLABLE_FORM_PARSED_WITHOUT_TYPE_HINTS = 0, 137 FILLABLE_FORM_PARSED_WITHOUT_TYPE_HINTS = 0,
138 // Parsed a form that is potentially autofillable and contains at least one 138 // Parsed a form that is potentially autofillable and contains at least one
139 // web developer-specified field type hint, a la 139 // web developer-specified field type hint, a la
140 // http://is.gd/whatwg_autocomplete 140 // http://is.gd/whatwg_autocomplete
141 FILLABLE_FORM_PARSED_WITH_TYPE_HINTS, 141 FILLABLE_FORM_PARSED_WITH_TYPE_HINTS,
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 bool CanLog() const; 638 bool CanLog() const;
639 int64_t MillisecondsSinceFormLoaded() const; 639 int64_t MillisecondsSinceFormLoaded() const;
640 void GetNewSourceID(); 640 void GetNewSourceID();
641 641
642 ukm::UkmService* ukm_service_; // Weak reference. 642 ukm::UkmService* ukm_service_; // Weak reference.
643 int32_t source_id_ = -1; 643 int32_t source_id_ = -1;
644 GURL url_; 644 GURL url_;
645 base::TimeTicks form_loaded_timestamp_; 645 base::TimeTicks form_loaded_timestamp_;
646 }; 646 };
647 647
648 static void LogCardUploadDecisionMetric(CardUploadDecisionMetric metric); 648 // |upload_decision_metrics| is a bitmask of |CardUploadDecisionMetric|.
649 static void LogCardUploadDecisionMetrics(int upload_decision_metrics);
649 static void LogCreditCardInfoBarMetric( 650 static void LogCreditCardInfoBarMetric(
650 InfoBarMetric metric, 651 InfoBarMetric metric,
651 bool is_uploading, 652 bool is_uploading,
652 int previous_save_credit_card_prompt_user_decision); 653 int previous_save_credit_card_prompt_user_decision);
653 static void LogCreditCardFillingInfoBarMetric(InfoBarMetric metric); 654 static void LogCreditCardFillingInfoBarMetric(InfoBarMetric metric);
654 static void LogSaveCardPromptMetric( 655 static void LogSaveCardPromptMetric(
655 SaveCardPromptMetric metric, 656 SaveCardPromptMetric metric,
656 bool is_uploading, 657 bool is_uploading,
657 bool is_reshow, 658 bool is_reshow,
658 int previous_save_credit_card_prompt_user_decision); 659 int previous_save_credit_card_prompt_user_decision);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 static void LogIsQueriedCreditCardFormSecure(bool is_secure); 798 static void LogIsQueriedCreditCardFormSecure(bool is_secure);
798 799
799 // Log how the converted wallet address was added to the local autofill 800 // Log how the converted wallet address was added to the local autofill
800 // profiles. 801 // profiles.
801 static void LogWalletAddressConversionType(WalletAddressConversionType type); 802 static void LogWalletAddressConversionType(WalletAddressConversionType type);
802 803
803 // This should be called when the user selects the Form-Not-Secure warning 804 // This should be called when the user selects the Form-Not-Secure warning
804 // suggestion to show an explanation of the warning. 805 // suggestion to show an explanation of the warning.
805 static void LogShowedHttpNotSecureExplanation(); 806 static void LogShowedHttpNotSecureExplanation();
806 807
807 // Logs the card upload decision ukm based on the specified |url| and 808 // Logs the card upload decisions ukm for the specified |url|.
808 // |upload_decision|. 809 // |upload_decision_metrics| is a bitmask of |CardUploadDecisionMetric|.
809 static void LogCardUploadDecisionUkm( 810 static void LogCardUploadDecisionsUkm(ukm::UkmService* ukm_service,
810 ukm::UkmService* ukm_service, 811 const GURL& url,
811 const GURL& url, 812 int upload_decision_metrics);
812 AutofillMetrics::CardUploadDecisionMetric upload_decision);
813 813
814 // Logs the developer engagement ukm for the specified |url| and autofill 814 // Logs the developer engagement ukm for the specified |url| and autofill
815 // fields in the form structure. 815 // fields in the form structure. |developer_engagement_metrics| is a bitmask
816 static void LogDeveloperEngagementUkm( 816 // of |AutofillMetrics::DeveloperEngagementMetric|.
817 ukm::UkmService* ukm_service, 817 static void LogDeveloperEngagementUkm(ukm::UkmService* ukm_service,
818 const GURL& url, 818 const GURL& url,
819 std::vector<AutofillMetrics::DeveloperEngagementMetric> metrics); 819 int developer_engagement_metrics);
820 820
821 // Logs the the |ukm_entry_name| with the specified |url| and the specified 821 // Logs the the |ukm_entry_name| with the specified |url| and the specified
822 // |metrics|. Returns whether the ukm was sucessfully logged. 822 // |metrics|. Returns whether the ukm was sucessfully logged.
823 static bool LogUkm(ukm::UkmService* ukm_service, 823 static bool LogUkm(ukm::UkmService* ukm_service,
824 const GURL& url, 824 const GURL& url,
825 const std::string& ukm_entry_name, 825 const std::string& ukm_entry_name,
826 const std::vector<std::pair<const char*, int>>& metrics); 826 const std::vector<std::pair<const char*, int>>& metrics);
827 827
828 // Utility to log autofill form events in the relevant histograms depending on 828 // Utility to log autofill form events in the relevant histograms depending on
829 // the presence of server and/or local data. 829 // the presence of server and/or local data.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 bool logged_suggestion_filled_was_masked_server_card_; 879 bool logged_suggestion_filled_was_masked_server_card_;
880 880
881 // The last field that was polled for suggestions. 881 // The last field that was polled for suggestions.
882 FormFieldData last_polled_field_; 882 FormFieldData last_polled_field_;
883 883
884 FormInteractionsUkmLogger* 884 FormInteractionsUkmLogger*
885 form_interactions_ukm_logger_; // Weak reference. 885 form_interactions_ukm_logger_; // Weak reference.
886 }; 886 };
887 887
888 private: 888 private:
889 static const int kNumCardUploadDecisionMetrics = 9;
890
889 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics); 891 DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillMetrics);
890 }; 892 };
891 893
892 } // namespace autofill 894 } // namespace autofill
893 895
894 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ 896 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_manager_unittest.cc ('k') | components/autofill/core/browser/autofill_metrics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698