OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ |
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ | 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <string> | 10 #include <string> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // Our heuristics detected at least one auto-fillable field, and the server | 72 // Our heuristics detected at least one auto-fillable field, and the server |
73 // response overrode the type of at least one field. | 73 // response overrode the type of at least one field. |
74 QUERY_RESPONSE_OVERRODE_LOCAL_HEURISTICS, | 74 QUERY_RESPONSE_OVERRODE_LOCAL_HEURISTICS, |
75 | 75 |
76 // Our heuristics did not detect any auto-fillable fields, but the server | 76 // Our heuristics did not detect any auto-fillable fields, but the server |
77 // response did detect at least one. | 77 // response did detect at least one. |
78 QUERY_RESPONSE_WITH_NO_LOCAL_HEURISTICS, | 78 QUERY_RESPONSE_WITH_NO_LOCAL_HEURISTICS, |
79 NUM_SERVER_QUERY_METRICS | 79 NUM_SERVER_QUERY_METRICS |
80 }; | 80 }; |
81 | 81 |
| 82 // Each of these metrics is logged only for potentially autofillable forms, |
| 83 // i.e. forms with at least three fields, etc. |
| 84 // These are used to derive certain "user happiness" metrics. For example, we |
| 85 // can compute the ratio (USER_DID_EDIT_AUTOFILLED_FIELD / USER_DID_AUTOFILL) |
| 86 // to see how often users have to correct autofilled data. |
| 87 enum UserHappinessMetric { |
| 88 // Loaded a page containing forms. |
| 89 FORMS_LOADED, |
| 90 // Submitted a fillable form -- i.e. one with at least three field values |
| 91 // that match the user's stored Autofill data -- and all matching fields |
| 92 // were autofilled. |
| 93 SUBMITTED_FILLABLE_FORM_AUTOFILLED_ALL, |
| 94 // Submitted a fillable form and some (but not all) matching fields were |
| 95 // autofilled. |
| 96 SUBMITTED_FILLABLE_FORM_AUTOFILLED_SOME, |
| 97 // Submitted a fillable form and no fields were autofilled. |
| 98 SUBMITTED_FILLABLE_FORM_AUTOFILLED_NONE, |
| 99 // Submitted a non-fillable form. |
| 100 SUBMITTED_NON_FILLABLE_FORM, |
| 101 |
| 102 // User manually filled one of the form fields. |
| 103 USER_DID_TYPE, |
| 104 // We showed a popup containing Autofill suggestions. |
| 105 SUGGESTIONS_SHOWN, |
| 106 // Same as above, but only logged once per page load. |
| 107 SUGGESTIONS_SHOWN_ONCE, |
| 108 // User autofilled at least part of the form. |
| 109 USER_DID_AUTOFILL, |
| 110 // Same as above, but only logged once per page load. |
| 111 USER_DID_AUTOFILL_ONCE, |
| 112 // User edited a previously autofilled field. |
| 113 USER_DID_EDIT_AUTOFILLED_FIELD, |
| 114 // Same as above, but only logged once per page load. |
| 115 USER_DID_EDIT_AUTOFILLED_FIELD_ONCE, |
| 116 NUM_USER_HAPPINESS_METRICS |
| 117 }; |
| 118 |
| 119 // TODO(isherman): Add histograms to measure time elapsed between form load |
| 120 // form submission, comparing autofilled and non-autofilled forms. So that we |
| 121 // are measuring apples to apples, restrict just to fillable forms. |
| 122 |
82 AutofillMetrics(); | 123 AutofillMetrics(); |
83 virtual ~AutofillMetrics(); | 124 virtual ~AutofillMetrics(); |
84 | 125 |
85 virtual void LogCreditCardInfoBarMetric(InfoBarMetric metric) const; | 126 virtual void LogCreditCardInfoBarMetric(InfoBarMetric metric) const; |
86 | 127 |
87 virtual void LogHeuristicTypePrediction( | 128 virtual void LogHeuristicTypePrediction( |
88 FieldTypeQualityMetric metric, | 129 FieldTypeQualityMetric metric, |
89 AutofillFieldType field_type, | 130 AutofillFieldType field_type, |
90 const std::string& experiment_id) const; | 131 const std::string& experiment_id) const; |
91 virtual void LogOverallTypePrediction( | 132 virtual void LogOverallTypePrediction( |
92 FieldTypeQualityMetric metric, | 133 FieldTypeQualityMetric metric, |
93 AutofillFieldType field_type, | 134 AutofillFieldType field_type, |
94 const std::string& experiment_id) const; | 135 const std::string& experiment_id) const; |
95 virtual void LogServerTypePrediction(FieldTypeQualityMetric metric, | 136 virtual void LogServerTypePrediction(FieldTypeQualityMetric metric, |
96 AutofillFieldType field_type, | 137 AutofillFieldType field_type, |
97 const std::string& experiment_id) const; | 138 const std::string& experiment_id) const; |
98 | 139 |
99 virtual void LogQualityMetric(QualityMetric metric, | 140 virtual void LogQualityMetric(QualityMetric metric, |
100 const std::string& experiment_id) const; | 141 const std::string& experiment_id) const; |
101 | 142 |
102 virtual void LogServerQueryMetric(ServerQueryMetric metric) const; | 143 virtual void LogServerQueryMetric(ServerQueryMetric metric) const; |
103 | 144 |
| 145 virtual void LogUserHappinessMetric(UserHappinessMetric metric) const; |
| 146 |
104 | 147 |
105 // This should be called each time a page containing forms is loaded. | 148 // This should be called each time a page containing forms is loaded. |
106 virtual void LogIsAutofillEnabledAtPageLoad(bool enabled) const; | 149 virtual void LogIsAutofillEnabledAtPageLoad(bool enabled) const; |
107 | 150 |
108 // This should be called each time a new profile is launched. | 151 // This should be called each time a new profile is launched. |
109 virtual void LogIsAutofillEnabledAtStartup(bool enabled) const; | 152 virtual void LogIsAutofillEnabledAtStartup(bool enabled) const; |
110 | 153 |
111 // This should be called each time a new profile is launched. | 154 // This should be called each time a new profile is launched. |
112 virtual void LogStoredProfileCount(size_t num_profiles) const; | 155 virtual void LogStoredProfileCount(size_t num_profiles) const; |
113 | 156 |
114 // Log the number of Autofill suggestions presented to the user when filling a | 157 // Log the number of Autofill suggestions presented to the user when filling a |
115 // form. | 158 // form. |
116 virtual void LogAddressSuggestionsCount(size_t num_suggestions) const; | 159 virtual void LogAddressSuggestionsCount(size_t num_suggestions) const; |
117 | 160 |
118 // Logs the experiment id corresponding to a server query response. | 161 // Logs the experiment id corresponding to a server query response. |
119 virtual void LogServerExperimentIdForQuery( | 162 virtual void LogServerExperimentIdForQuery( |
120 const std::string& experiment_id) const; | 163 const std::string& experiment_id) const; |
121 | 164 |
122 // Logs the experiment id corresponding to an upload to the server. | 165 // Logs the experiment id corresponding to an upload to the server. |
123 virtual void LogServerExperimentIdForUpload( | 166 virtual void LogServerExperimentIdForUpload( |
124 const std::string& experiment_id) const; | 167 const std::string& experiment_id) const; |
125 | 168 |
126 private: | 169 private: |
127 DISALLOW_COPY_AND_ASSIGN(AutofillMetrics); | 170 DISALLOW_COPY_AND_ASSIGN(AutofillMetrics); |
128 }; | 171 }; |
129 | 172 |
130 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ | 173 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_METRICS_H_ |
OLD | NEW |