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 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 GROUP_CREDIT_CARD_DATE, | 73 GROUP_CREDIT_CARD_DATE, |
74 GROUP_CREDIT_CARD_TYPE, | 74 GROUP_CREDIT_CARD_TYPE, |
75 GROUP_PASSWORD, | 75 GROUP_PASSWORD, |
76 GROUP_ADDRESS_LINE_3, | 76 GROUP_ADDRESS_LINE_3, |
77 GROUP_USERNAME, | 77 GROUP_USERNAME, |
78 GROUP_STREET_ADDRESS, | 78 GROUP_STREET_ADDRESS, |
79 GROUP_CREDIT_CARD_VERIFICATION, | 79 GROUP_CREDIT_CARD_VERIFICATION, |
80 NUM_FIELD_TYPE_GROUPS_FOR_METRICS | 80 NUM_FIELD_TYPE_GROUPS_FOR_METRICS |
81 }; | 81 }; |
82 | 82 |
| 83 std::string PreviousSaveCreditCardPromptUserDecisionToString( |
| 84 int previous_save_credit_card_prompt_user_decision) { |
| 85 DCHECK_LT(previous_save_credit_card_prompt_user_decision, |
| 86 prefs::NUM_PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISIONS); |
| 87 std::string previous_response; |
| 88 if (previous_save_credit_card_prompt_user_decision == |
| 89 prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED) |
| 90 previous_response = ".PreviouslyAccepted"; |
| 91 else if (previous_save_credit_card_prompt_user_decision == |
| 92 prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED) |
| 93 previous_response = ".PreviouslyDenied"; |
| 94 else |
| 95 DCHECK_EQ(previous_save_credit_card_prompt_user_decision, |
| 96 prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE); |
| 97 return previous_response; |
| 98 } |
| 99 |
83 } // namespace | 100 } // namespace |
84 | 101 |
85 // First, translates |field_type| to the corresponding logical |group| from | 102 // First, translates |field_type| to the corresponding logical |group| from |
86 // |FieldTypeGroupForMetrics|. Then, interpolates this with the given |metric|, | 103 // |FieldTypeGroupForMetrics|. Then, interpolates this with the given |metric|, |
87 // which should be in the range [0, |num_possible_metrics|). | 104 // which should be in the range [0, |num_possible_metrics|). |
88 // Returns the interpolated index. | 105 // Returns the interpolated index. |
89 // | 106 // |
90 // The interpolation maps the pair (|group|, |metric|) to a single index, so | 107 // The interpolation maps the pair (|group|, |metric|) to a single index, so |
91 // that all the indicies for a given group are adjacent. In particular, with | 108 // that all the indicies for a given group are adjacent. In particular, with |
92 // the groups {AMBIGUOUS, NAME, ...} combining with the metrics {UNKNOWN, MATCH, | 109 // the groups {AMBIGUOUS, NAME, ...} combining with the metrics {UNKNOWN, MATCH, |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 308 |
292 // static | 309 // static |
293 void AutofillMetrics::LogCardUploadDecisionMetric( | 310 void AutofillMetrics::LogCardUploadDecisionMetric( |
294 CardUploadDecisionMetric metric) { | 311 CardUploadDecisionMetric metric) { |
295 DCHECK_LT(metric, NUM_CARD_UPLOAD_DECISION_METRICS); | 312 DCHECK_LT(metric, NUM_CARD_UPLOAD_DECISION_METRICS); |
296 UMA_HISTOGRAM_ENUMERATION("Autofill.CardUploadDecisionExpanded", metric, | 313 UMA_HISTOGRAM_ENUMERATION("Autofill.CardUploadDecisionExpanded", metric, |
297 NUM_CARD_UPLOAD_DECISION_METRICS); | 314 NUM_CARD_UPLOAD_DECISION_METRICS); |
298 } | 315 } |
299 | 316 |
300 // static | 317 // static |
301 void AutofillMetrics::LogCreditCardInfoBarMetric(InfoBarMetric metric, | 318 void AutofillMetrics::LogCreditCardInfoBarMetric( |
302 bool is_uploading) { | 319 InfoBarMetric metric, |
| 320 bool is_uploading, |
| 321 int previous_save_credit_card_prompt_user_decision) { |
303 DCHECK_LT(metric, NUM_INFO_BAR_METRICS); | 322 DCHECK_LT(metric, NUM_INFO_BAR_METRICS); |
304 if (is_uploading) { | 323 |
305 UMA_HISTOGRAM_ENUMERATION("Autofill.CreditCardInfoBar.Server", metric, | 324 std::string destination = is_uploading ? ".Server" : ".Local"; |
306 NUM_INFO_BAR_METRICS); | 325 LogUMAHistogramEnumeration( |
307 } else { | 326 "Autofill.CreditCardInfoBar" + destination + |
308 UMA_HISTOGRAM_ENUMERATION("Autofill.CreditCardInfoBar.Local", metric, | 327 PreviousSaveCreditCardPromptUserDecisionToString( |
309 NUM_INFO_BAR_METRICS); | 328 previous_save_credit_card_prompt_user_decision), |
310 } | 329 metric, NUM_INFO_BAR_METRICS); |
311 } | 330 } |
312 | 331 |
313 // static | 332 // static |
314 void AutofillMetrics::LogCreditCardFillingInfoBarMetric(InfoBarMetric metric) { | 333 void AutofillMetrics::LogCreditCardFillingInfoBarMetric(InfoBarMetric metric) { |
315 DCHECK_LT(metric, NUM_INFO_BAR_METRICS); | 334 DCHECK_LT(metric, NUM_INFO_BAR_METRICS); |
316 UMA_HISTOGRAM_ENUMERATION("Autofill.CreditCardFillingInfoBar", metric, | 335 UMA_HISTOGRAM_ENUMERATION("Autofill.CreditCardFillingInfoBar", metric, |
317 NUM_INFO_BAR_METRICS); | 336 NUM_INFO_BAR_METRICS); |
318 } | 337 } |
319 | 338 |
320 // static | 339 // static |
321 void AutofillMetrics::LogSaveCardPromptMetric(SaveCardPromptMetric metric, | 340 void AutofillMetrics::LogSaveCardPromptMetric( |
322 bool is_uploading, | 341 SaveCardPromptMetric metric, |
323 bool is_reshow) { | 342 bool is_uploading, |
| 343 bool is_reshow, |
| 344 int previous_save_credit_card_prompt_user_decision) { |
324 DCHECK_LT(metric, NUM_SAVE_CARD_PROMPT_METRICS); | 345 DCHECK_LT(metric, NUM_SAVE_CARD_PROMPT_METRICS); |
325 std::string destination = is_uploading ? ".Upload" : ".Local"; | 346 std::string destination = is_uploading ? ".Upload" : ".Local"; |
326 std::string show = is_reshow ? ".Reshows" : ".FirstShow"; | 347 std::string show = is_reshow ? ".Reshows" : ".FirstShow"; |
327 LogUMAHistogramEnumeration( | 348 LogUMAHistogramEnumeration( |
328 "Autofill.SaveCreditCardPrompt" + destination + show, metric, | 349 "Autofill.SaveCreditCardPrompt" + destination + show + |
329 NUM_SAVE_CARD_PROMPT_METRICS); | 350 PreviousSaveCreditCardPromptUserDecisionToString( |
| 351 previous_save_credit_card_prompt_user_decision), |
| 352 metric, NUM_SAVE_CARD_PROMPT_METRICS); |
330 } | 353 } |
331 | 354 |
332 // static | 355 // static |
333 void AutofillMetrics::LogScanCreditCardPromptMetric( | 356 void AutofillMetrics::LogScanCreditCardPromptMetric( |
334 ScanCreditCardPromptMetric metric) { | 357 ScanCreditCardPromptMetric metric) { |
335 DCHECK_LT(metric, NUM_SCAN_CREDIT_CARD_PROMPT_METRICS); | 358 DCHECK_LT(metric, NUM_SCAN_CREDIT_CARD_PROMPT_METRICS); |
336 UMA_HISTOGRAM_ENUMERATION("Autofill.ScanCreditCardPrompt", metric, | 359 UMA_HISTOGRAM_ENUMERATION("Autofill.ScanCreditCardPrompt", metric, |
337 NUM_SCAN_CREDIT_CARD_PROMPT_METRICS); | 360 NUM_SCAN_CREDIT_CARD_PROMPT_METRICS); |
338 } | 361 } |
339 | 362 |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1128 DCHECK(!form_loaded_timestamp_.is_null()); | 1151 DCHECK(!form_loaded_timestamp_.is_null()); |
1129 return (base::TimeTicks::Now() - form_loaded_timestamp_).InMilliseconds(); | 1152 return (base::TimeTicks::Now() - form_loaded_timestamp_).InMilliseconds(); |
1130 } | 1153 } |
1131 | 1154 |
1132 void AutofillMetrics::FormInteractionsUkmLogger::GetNewSourceID() { | 1155 void AutofillMetrics::FormInteractionsUkmLogger::GetNewSourceID() { |
1133 source_id_ = ukm_service_->GetNewSourceID(); | 1156 source_id_ = ukm_service_->GetNewSourceID(); |
1134 ukm_service_->UpdateSourceURL(source_id_, url_); | 1157 ukm_service_->UpdateSourceURL(source_id_, url_); |
1135 } | 1158 } |
1136 | 1159 |
1137 } // namespace autofill | 1160 } // namespace autofill |
OLD | NEW |