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 return previous_response; | |
Mark P
2017/04/27 22:52:58
optional nit while I'm here:
DCHECK_EQ(PREVIOUS_SA
csashi
2017/04/27 23:37:51
Done.
| |
95 } | |
96 | |
83 } // namespace | 97 } // namespace |
84 | 98 |
85 // First, translates |field_type| to the corresponding logical |group| from | 99 // First, translates |field_type| to the corresponding logical |group| from |
86 // |FieldTypeGroupForMetrics|. Then, interpolates this with the given |metric|, | 100 // |FieldTypeGroupForMetrics|. Then, interpolates this with the given |metric|, |
87 // which should be in the range [0, |num_possible_metrics|). | 101 // which should be in the range [0, |num_possible_metrics|). |
88 // Returns the interpolated index. | 102 // Returns the interpolated index. |
89 // | 103 // |
90 // The interpolation maps the pair (|group|, |metric|) to a single index, so | 104 // 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 | 105 // that all the indicies for a given group are adjacent. In particular, with |
92 // the groups {AMBIGUOUS, NAME, ...} combining with the metrics {UNKNOWN, MATCH, | 106 // the groups {AMBIGUOUS, NAME, ...} combining with the metrics {UNKNOWN, MATCH, |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
291 | 305 |
292 // static | 306 // static |
293 void AutofillMetrics::LogCardUploadDecisionMetric( | 307 void AutofillMetrics::LogCardUploadDecisionMetric( |
294 CardUploadDecisionMetric metric) { | 308 CardUploadDecisionMetric metric) { |
295 DCHECK_LT(metric, NUM_CARD_UPLOAD_DECISION_METRICS); | 309 DCHECK_LT(metric, NUM_CARD_UPLOAD_DECISION_METRICS); |
296 UMA_HISTOGRAM_ENUMERATION("Autofill.CardUploadDecisionExpanded", metric, | 310 UMA_HISTOGRAM_ENUMERATION("Autofill.CardUploadDecisionExpanded", metric, |
297 NUM_CARD_UPLOAD_DECISION_METRICS); | 311 NUM_CARD_UPLOAD_DECISION_METRICS); |
298 } | 312 } |
299 | 313 |
300 // static | 314 // static |
301 void AutofillMetrics::LogCreditCardInfoBarMetric(InfoBarMetric metric, | 315 void AutofillMetrics::LogCreditCardInfoBarMetric( |
302 bool is_uploading) { | 316 InfoBarMetric metric, |
317 bool is_uploading, | |
318 int previous_save_credit_card_prompt_user_decision) { | |
303 DCHECK_LT(metric, NUM_INFO_BAR_METRICS); | 319 DCHECK_LT(metric, NUM_INFO_BAR_METRICS); |
304 if (is_uploading) { | 320 |
305 UMA_HISTOGRAM_ENUMERATION("Autofill.CreditCardInfoBar.Server", metric, | 321 std::string destination = is_uploading ? ".Server" : ".Local"; |
306 NUM_INFO_BAR_METRICS); | 322 LogUMAHistogramEnumeration( |
307 } else { | 323 "Autofill.CreditCardInfoBar" + destination + |
308 UMA_HISTOGRAM_ENUMERATION("Autofill.CreditCardInfoBar.Local", metric, | 324 PreviousSaveCreditCardPromptUserDecisionToString( |
Mark P
2017/04/27 22:52:58
This structure makes is to there is no longer a si
csashi
2017/04/27 23:37:51
It is useful to view the aggregate but I would rat
| |
309 NUM_INFO_BAR_METRICS); | 325 previous_save_credit_card_prompt_user_decision), |
310 } | 326 metric, NUM_INFO_BAR_METRICS); |
311 } | 327 } |
312 | 328 |
313 // static | 329 // static |
314 void AutofillMetrics::LogCreditCardFillingInfoBarMetric(InfoBarMetric metric) { | 330 void AutofillMetrics::LogCreditCardFillingInfoBarMetric(InfoBarMetric metric) { |
315 DCHECK_LT(metric, NUM_INFO_BAR_METRICS); | 331 DCHECK_LT(metric, NUM_INFO_BAR_METRICS); |
316 UMA_HISTOGRAM_ENUMERATION("Autofill.CreditCardFillingInfoBar", metric, | 332 UMA_HISTOGRAM_ENUMERATION("Autofill.CreditCardFillingInfoBar", metric, |
317 NUM_INFO_BAR_METRICS); | 333 NUM_INFO_BAR_METRICS); |
318 } | 334 } |
319 | 335 |
320 // static | 336 // static |
321 void AutofillMetrics::LogSaveCardPromptMetric(SaveCardPromptMetric metric, | 337 void AutofillMetrics::LogSaveCardPromptMetric( |
322 bool is_uploading, | 338 SaveCardPromptMetric metric, |
323 bool is_reshow) { | 339 bool is_uploading, |
340 bool is_reshow, | |
341 int previous_save_credit_card_prompt_user_decision) { | |
324 DCHECK_LT(metric, NUM_SAVE_CARD_PROMPT_METRICS); | 342 DCHECK_LT(metric, NUM_SAVE_CARD_PROMPT_METRICS); |
325 std::string destination = is_uploading ? ".Upload" : ".Local"; | 343 std::string destination = is_uploading ? ".Upload" : ".Local"; |
326 std::string show = is_reshow ? ".Reshows" : ".FirstShow"; | 344 std::string show = is_reshow ? ".Reshows" : ".FirstShow"; |
327 LogUMAHistogramEnumeration( | 345 LogUMAHistogramEnumeration( |
328 "Autofill.SaveCreditCardPrompt" + destination + show, metric, | 346 "Autofill.SaveCreditCardPrompt" + destination + show + |
329 NUM_SAVE_CARD_PROMPT_METRICS); | 347 PreviousSaveCreditCardPromptUserDecisionToString( |
348 previous_save_credit_card_prompt_user_decision), | |
349 metric, NUM_SAVE_CARD_PROMPT_METRICS); | |
330 } | 350 } |
331 | 351 |
332 // static | 352 // static |
333 void AutofillMetrics::LogScanCreditCardPromptMetric( | 353 void AutofillMetrics::LogScanCreditCardPromptMetric( |
334 ScanCreditCardPromptMetric metric) { | 354 ScanCreditCardPromptMetric metric) { |
335 DCHECK_LT(metric, NUM_SCAN_CREDIT_CARD_PROMPT_METRICS); | 355 DCHECK_LT(metric, NUM_SCAN_CREDIT_CARD_PROMPT_METRICS); |
336 UMA_HISTOGRAM_ENUMERATION("Autofill.ScanCreditCardPrompt", metric, | 356 UMA_HISTOGRAM_ENUMERATION("Autofill.ScanCreditCardPrompt", metric, |
337 NUM_SCAN_CREDIT_CARD_PROMPT_METRICS); | 357 NUM_SCAN_CREDIT_CARD_PROMPT_METRICS); |
338 } | 358 } |
339 | 359 |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1128 DCHECK(!form_loaded_timestamp_.is_null()); | 1148 DCHECK(!form_loaded_timestamp_.is_null()); |
1129 return (base::TimeTicks::Now() - form_loaded_timestamp_).InMilliseconds(); | 1149 return (base::TimeTicks::Now() - form_loaded_timestamp_).InMilliseconds(); |
1130 } | 1150 } |
1131 | 1151 |
1132 void AutofillMetrics::FormInteractionsUkmLogger::GetNewSourceID() { | 1152 void AutofillMetrics::FormInteractionsUkmLogger::GetNewSourceID() { |
1133 source_id_ = ukm_service_->GetNewSourceID(); | 1153 source_id_ = ukm_service_->GetNewSourceID(); |
1134 ukm_service_->UpdateSourceURL(source_id_, url_); | 1154 ukm_service_->UpdateSourceURL(source_id_, url_); |
1135 } | 1155 } |
1136 | 1156 |
1137 } // namespace autofill | 1157 } // namespace autofill |
OLD | NEW |