| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "components/autofill/core/browser/autofill_type.h" | 10 #include "components/autofill/core/browser/autofill_type.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 case AutofillMetrics::ACCEPT_LEGAL_DOCUMENTS: | 177 case AutofillMetrics::ACCEPT_LEGAL_DOCUMENTS: |
| 178 return "AcceptLegalDocuments"; | 178 return "AcceptLegalDocuments"; |
| 179 case AutofillMetrics::AUTHENTICATE_INSTRUMENT: | 179 case AutofillMetrics::AUTHENTICATE_INSTRUMENT: |
| 180 return "AuthenticateInstrument"; | 180 return "AuthenticateInstrument"; |
| 181 case AutofillMetrics::GET_FULL_WALLET: | 181 case AutofillMetrics::GET_FULL_WALLET: |
| 182 return "GetFullWallet"; | 182 return "GetFullWallet"; |
| 183 case AutofillMetrics::GET_WALLET_ITEMS: | 183 case AutofillMetrics::GET_WALLET_ITEMS: |
| 184 return "GetWalletItems"; | 184 return "GetWalletItems"; |
| 185 case AutofillMetrics::SAVE_TO_WALLET: | 185 case AutofillMetrics::SAVE_TO_WALLET: |
| 186 return "SaveToWallet"; | 186 return "SaveToWallet"; |
| 187 case AutofillMetrics::SEND_STATUS: | |
| 188 return "SendStatus"; | |
| 189 case AutofillMetrics::UNKNOWN_API_CALL: | 187 case AutofillMetrics::UNKNOWN_API_CALL: |
| 190 NOTREACHED(); | 188 NOTREACHED(); |
| 191 return "UnknownApiCall"; | 189 return "UnknownApiCall"; |
| 192 } | 190 } |
| 193 | 191 |
| 194 NOTREACHED(); | 192 NOTREACHED(); |
| 195 return "UnknownApiCall"; | 193 return "UnknownApiCall"; |
| 196 } | 194 } |
| 197 | 195 |
| 198 // A version of the UMA_HISTOGRAM_ENUMERATION macro that allows the |name| | 196 // A version of the UMA_HISTOGRAM_ENUMERATION macro that allows the |name| |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 LogUMAHistogramEnumeration(sub_histogram_name, | 267 LogUMAHistogramEnumeration(sub_histogram_name, |
| 270 field_type_group_metric, | 268 field_type_group_metric, |
| 271 num_field_type_group_metrics); | 269 num_field_type_group_metrics); |
| 272 } | 270 } |
| 273 | 271 |
| 274 void LogServerExperimentId(const std::string& histogram_name, | 272 void LogServerExperimentId(const std::string& histogram_name, |
| 275 const std::string& experiment_id) { | 273 const std::string& experiment_id) { |
| 276 ServerExperiment metric = UNKNOWN_EXPERIMENT; | 274 ServerExperiment metric = UNKNOWN_EXPERIMENT; |
| 277 | 275 |
| 278 const std::string default_experiment_name = | 276 const std::string default_experiment_name = |
| 279 FormStructure(FormData(), std::string()).server_experiment_id(); | 277 FormStructure(FormData()).server_experiment_id(); |
| 280 if (experiment_id.empty()) | 278 if (experiment_id.empty()) |
| 281 metric = NO_EXPERIMENT; | 279 metric = NO_EXPERIMENT; |
| 282 else if (experiment_id == "ar06") | 280 else if (experiment_id == "ar06") |
| 283 metric = ACCEPTANCE_RATIO_06; | 281 metric = ACCEPTANCE_RATIO_06; |
| 284 else if (experiment_id == "ar1") | 282 else if (experiment_id == "ar1") |
| 285 metric = ACCEPTANCE_RATIO_1; | 283 metric = ACCEPTANCE_RATIO_1; |
| 286 else if (experiment_id == "ar2") | 284 else if (experiment_id == "ar2") |
| 287 metric = ACCEPTANCE_RATIO_2; | 285 metric = ACCEPTANCE_RATIO_2; |
| 288 else if (experiment_id == "ar4") | 286 else if (experiment_id == "ar4") |
| 289 metric = ACCEPTANCE_RATIO_4; | 287 metric = ACCEPTANCE_RATIO_4; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 317 } | 315 } |
| 318 | 316 |
| 319 } // namespace | 317 } // namespace |
| 320 | 318 |
| 321 AutofillMetrics::AutofillMetrics() { | 319 AutofillMetrics::AutofillMetrics() { |
| 322 } | 320 } |
| 323 | 321 |
| 324 AutofillMetrics::~AutofillMetrics() { | 322 AutofillMetrics::~AutofillMetrics() { |
| 325 } | 323 } |
| 326 | 324 |
| 327 void AutofillMetrics::LogAutocheckoutBubbleMetric(BubbleMetric metric) const { | |
| 328 DCHECK_LT(metric, NUM_BUBBLE_METRICS); | |
| 329 | |
| 330 UMA_HISTOGRAM_ENUMERATION("Autocheckout.Bubble", metric, NUM_BUBBLE_METRICS); | |
| 331 } | |
| 332 | |
| 333 void AutofillMetrics::LogAutocheckoutBuyFlowMetric( | |
| 334 AutocheckoutBuyFlowMetric metric) const { | |
| 335 DCHECK_LT(metric, NUM_AUTOCHECKOUT_BUY_FLOW_METRICS); | |
| 336 | |
| 337 UMA_HISTOGRAM_ENUMERATION("Autocheckout.BuyFlow", metric, | |
| 338 NUM_AUTOCHECKOUT_BUY_FLOW_METRICS); | |
| 339 } | |
| 340 | |
| 341 void AutofillMetrics::LogCreditCardInfoBarMetric(InfoBarMetric metric) const { | 325 void AutofillMetrics::LogCreditCardInfoBarMetric(InfoBarMetric metric) const { |
| 342 DCHECK_LT(metric, NUM_INFO_BAR_METRICS); | 326 DCHECK_LT(metric, NUM_INFO_BAR_METRICS); |
| 343 | 327 |
| 344 UMA_HISTOGRAM_ENUMERATION("Autofill.CreditCardInfoBar", metric, | 328 UMA_HISTOGRAM_ENUMERATION("Autofill.CreditCardInfoBar", metric, |
| 345 NUM_INFO_BAR_METRICS); | 329 NUM_INFO_BAR_METRICS); |
| 346 } | 330 } |
| 347 | 331 |
| 348 void AutofillMetrics::LogDialogDismissalState( | 332 void AutofillMetrics::LogDialogDismissalState( |
| 349 autofill::DialogType dialog_type, | 333 autofill::DialogType dialog_type, |
| 350 DialogDismissalState state) const { | 334 DialogDismissalState state) const { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 | 407 |
| 424 void AutofillMetrics::LogWalletRequiredActionMetric( | 408 void AutofillMetrics::LogWalletRequiredActionMetric( |
| 425 autofill::DialogType dialog_type, | 409 autofill::DialogType dialog_type, |
| 426 WalletRequiredActionMetric required_action) const { | 410 WalletRequiredActionMetric required_action) const { |
| 427 std::string name = | 411 std::string name = |
| 428 GetPrefixForDialogType(dialog_type) + ".WalletRequiredActions"; | 412 GetPrefixForDialogType(dialog_type) + ".WalletRequiredActions"; |
| 429 LogUMAHistogramEnumeration( | 413 LogUMAHistogramEnumeration( |
| 430 name, required_action, NUM_WALLET_REQUIRED_ACTIONS); | 414 name, required_action, NUM_WALLET_REQUIRED_ACTIONS); |
| 431 } | 415 } |
| 432 | 416 |
| 433 void AutofillMetrics::LogAutocheckoutDuration( | |
| 434 const base::TimeDelta& duration, | |
| 435 AutocheckoutCompletionStatus status) const { | |
| 436 std::string suffix; | |
| 437 switch (status) { | |
| 438 case AUTOCHECKOUT_CANCELLED: | |
| 439 suffix = "Cancelled"; | |
| 440 break; | |
| 441 | |
| 442 case AUTOCHECKOUT_FAILED: | |
| 443 suffix = "Failed"; | |
| 444 break; | |
| 445 | |
| 446 case AUTOCHECKOUT_SUCCEEDED: | |
| 447 suffix = "Succeeded"; | |
| 448 break; | |
| 449 } | |
| 450 | |
| 451 LogUMAHistogramLongTimes("Autocheckout.FlowDuration", duration); | |
| 452 LogUMAHistogramLongTimes("Autocheckout.FlowDuration." + suffix, duration); | |
| 453 } | |
| 454 | |
| 455 void AutofillMetrics::LogAutocheckoutWhitelistDownloadDuration( | |
| 456 const base::TimeDelta& duration, | |
| 457 AutocheckoutWhitelistDownloadStatus status) const { | |
| 458 std::string suffix; | |
| 459 switch (status) { | |
| 460 case AUTOCHECKOUT_WHITELIST_DOWNLOAD_FAILED: | |
| 461 suffix = "Failed"; | |
| 462 break; | |
| 463 | |
| 464 case AUTOCHECKOUT_WHITELIST_DOWNLOAD_SUCCEEDED: | |
| 465 suffix = "Succeeded"; | |
| 466 break; | |
| 467 } | |
| 468 | |
| 469 LogUMAHistogramTimes("Autocheckout.WhitelistDownloadDuration", duration); | |
| 470 LogUMAHistogramTimes( | |
| 471 "Autocheckout.WhitelistDownloadDuration." + suffix, duration); | |
| 472 } | |
| 473 | |
| 474 void AutofillMetrics::LogDeveloperEngagementMetric( | 417 void AutofillMetrics::LogDeveloperEngagementMetric( |
| 475 DeveloperEngagementMetric metric) const { | 418 DeveloperEngagementMetric metric) const { |
| 476 DCHECK_LT(metric, NUM_DEVELOPER_ENGAGEMENT_METRICS); | 419 DCHECK_LT(metric, NUM_DEVELOPER_ENGAGEMENT_METRICS); |
| 477 | 420 |
| 478 UMA_HISTOGRAM_ENUMERATION("Autofill.DeveloperEngagement", metric, | 421 UMA_HISTOGRAM_ENUMERATION("Autofill.DeveloperEngagement", metric, |
| 479 NUM_DEVELOPER_ENGAGEMENT_METRICS); | 422 NUM_DEVELOPER_ENGAGEMENT_METRICS); |
| 480 } | 423 } |
| 481 | 424 |
| 482 void AutofillMetrics::LogHeuristicTypePrediction( | 425 void AutofillMetrics::LogHeuristicTypePrediction( |
| 483 FieldTypeQualityMetric metric, | 426 FieldTypeQualityMetric metric, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 const std::string& experiment_id) const { | 532 const std::string& experiment_id) const { |
| 590 LogServerExperimentId("Autofill.ServerExperimentId.Query", experiment_id); | 533 LogServerExperimentId("Autofill.ServerExperimentId.Query", experiment_id); |
| 591 } | 534 } |
| 592 | 535 |
| 593 void AutofillMetrics::LogServerExperimentIdForUpload( | 536 void AutofillMetrics::LogServerExperimentIdForUpload( |
| 594 const std::string& experiment_id) const { | 537 const std::string& experiment_id) const { |
| 595 LogServerExperimentId("Autofill.ServerExperimentId.Upload", experiment_id); | 538 LogServerExperimentId("Autofill.ServerExperimentId.Upload", experiment_id); |
| 596 } | 539 } |
| 597 | 540 |
| 598 } // namespace autofill | 541 } // namespace autofill |
| OLD | NEW |