| 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 #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 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "components/autofill/core/browser/autofill_manager_delegate.h" | 12 #include "components/autofill/core/browser/autofill_manager_delegate.h" |
| 13 #include "components/autofill/core/browser/field_types.h" | 13 #include "components/autofill/core/browser/field_types.h" |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class TimeDelta; | 16 class TimeDelta; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace autofill { | 19 namespace autofill { |
| 20 | 20 |
| 21 class AutofillMetrics { | 21 class AutofillMetrics { |
| 22 public: | 22 public: |
| 23 // The possible results of an Autocheckout flow. | |
| 24 enum AutocheckoutBuyFlowMetric { | |
| 25 // The user has initated Autocheckout. The baseline metric. | |
| 26 AUTOCHECKOUT_BUY_FLOW_STARTED, | |
| 27 // Autocheckout completed successfully. | |
| 28 AUTOCHECKOUT_BUY_FLOW_SUCCESS, | |
| 29 // Autocheckout failed due to missing server side data. | |
| 30 AUTOCHECKOUT_BUY_FLOW_MISSING_FIELDMAPPING, | |
| 31 // Autocheckout failed due to a missing proceed element. | |
| 32 AUTOCHECKOUT_BUY_FLOW_MISSING_ADVANCE_ELEMENT, | |
| 33 // Autocheckout failed for any number of other reasons, e.g, the proceed | |
| 34 // element click failed, the page numbers were not increasing, etc. | |
| 35 AUTOCHECKOUT_BUY_FLOW_CANNOT_PROCEED, | |
| 36 // Autocheckout failed due to a missing click element before form filling. | |
| 37 AUTOCHECKOUT_BUY_FLOW_MISSING_CLICK_ELEMENT_BEFORE_FORM_FILLING, | |
| 38 // Autocheckout failed due to a missing click element after form filling. | |
| 39 AUTOCHECKOUT_BUY_FLOW_MISSING_CLICK_ELEMENT_AFTER_FORM_FILLING, | |
| 40 NUM_AUTOCHECKOUT_BUY_FLOW_METRICS | |
| 41 }; | |
| 42 | |
| 43 // The success or failure of Autocheckout. | |
| 44 enum AutocheckoutCompletionStatus { | |
| 45 AUTOCHECKOUT_CANCELLED, // The user canceled Autocheckout while it was in | |
| 46 // progress. | |
| 47 AUTOCHECKOUT_FAILED, // The user canceled out of the dialog after | |
| 48 // an Autocheckout failure. | |
| 49 AUTOCHECKOUT_SUCCEEDED, // The dialog was closed after Autocheckout | |
| 50 // succeeded. | |
| 51 }; | |
| 52 | |
| 53 // The action a user took to dismiss a bubble. | |
| 54 enum BubbleMetric { | |
| 55 BUBBLE_CREATED = 0, // The bubble was created. | |
| 56 BUBBLE_ACCEPTED, // The user accepted, i.e. confirmed, the | |
| 57 // bubble. | |
| 58 BUBBLE_DISMISSED, // The user dismissed the bubble. | |
| 59 BUBBLE_IGNORED, // The user did not interact with the bubble. | |
| 60 BUBBLE_COULD_BE_DISPLAYED, // The bubble could be displayed. | |
| 61 NUM_BUBBLE_METRICS, | |
| 62 }; | |
| 63 | |
| 64 enum DeveloperEngagementMetric { | 23 enum DeveloperEngagementMetric { |
| 65 // Parsed a form that is potentially autofillable. | 24 // Parsed a form that is potentially autofillable. |
| 66 FILLABLE_FORM_PARSED = 0, | 25 FILLABLE_FORM_PARSED = 0, |
| 67 // Parsed a form that is potentially autofillable and contains at least one | 26 // Parsed a form that is potentially autofillable and contains at least one |
| 68 // web developer-specified field type hint, a la | 27 // web developer-specified field type hint, a la |
| 69 // http://is.gd/whatwg_autocomplete | 28 // http://is.gd/whatwg_autocomplete |
| 70 FILLABLE_FORM_CONTAINS_TYPE_HINTS, | 29 FILLABLE_FORM_CONTAINS_TYPE_HINTS, |
| 71 NUM_DEVELOPER_ENGAGEMENT_METRICS, | 30 NUM_DEVELOPER_ENGAGEMENT_METRICS, |
| 72 }; | 31 }; |
| 73 | 32 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL, | 71 DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL, |
| 113 // Signed in, no Wallet items, has verified Autofill profiles. | 72 // Signed in, no Wallet items, has verified Autofill profiles. |
| 114 DIALOG_USER_SIGNED_IN_NO_WALLET_HAS_AUTOFILL, | 73 DIALOG_USER_SIGNED_IN_NO_WALLET_HAS_AUTOFILL, |
| 115 // Signed in, has Wallet items, no verified Autofill profiles. | 74 // Signed in, has Wallet items, no verified Autofill profiles. |
| 116 DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL, | 75 DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL, |
| 117 // Signed in, has Wallet items, has verified Autofill profiles. | 76 // Signed in, has Wallet items, has verified Autofill profiles. |
| 118 DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL, | 77 DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL, |
| 119 NUM_DIALOG_INITIAL_USER_STATE_METRICS | 78 NUM_DIALOG_INITIAL_USER_STATE_METRICS |
| 120 }; | 79 }; |
| 121 | 80 |
| 122 // Events related to the Autofill popup shown in a requestAutocomplete or | 81 // Events related to the Autofill popup shown in a requestAutocomplete |
| 123 // Autocheckout dialog. | 82 // dialog. |
| 124 enum DialogPopupEvent { | 83 enum DialogPopupEvent { |
| 125 // An Autofill popup was shown. | 84 // An Autofill popup was shown. |
| 126 DIALOG_POPUP_SHOWN = 0, | 85 DIALOG_POPUP_SHOWN = 0, |
| 127 // The user chose to fill the form with a suggestion from the popup. | 86 // The user chose to fill the form with a suggestion from the popup. |
| 128 DIALOG_POPUP_FORM_FILLED, | 87 DIALOG_POPUP_FORM_FILLED, |
| 129 NUM_DIALOG_POPUP_EVENTS | 88 NUM_DIALOG_POPUP_EVENTS |
| 130 }; | 89 }; |
| 131 | 90 |
| 132 // For measuring the frequency of security warnings or errors that can come | 91 // For measuring the frequency of security warnings or errors that can come |
| 133 // up as part of the requestAutocomplete flow. | 92 // up as part of the requestAutocomplete flow. |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 }; | 248 }; |
| 290 | 249 |
| 291 // For measuring the network request time of various Wallet API calls. See | 250 // For measuring the network request time of various Wallet API calls. See |
| 292 // WalletClient::RequestType. | 251 // WalletClient::RequestType. |
| 293 enum WalletApiCallMetric { | 252 enum WalletApiCallMetric { |
| 294 UNKNOWN_API_CALL, // Catch all. Should never be used. | 253 UNKNOWN_API_CALL, // Catch all. Should never be used. |
| 295 ACCEPT_LEGAL_DOCUMENTS, | 254 ACCEPT_LEGAL_DOCUMENTS, |
| 296 AUTHENTICATE_INSTRUMENT, | 255 AUTHENTICATE_INSTRUMENT, |
| 297 GET_FULL_WALLET, | 256 GET_FULL_WALLET, |
| 298 GET_WALLET_ITEMS, | 257 GET_WALLET_ITEMS, |
| 299 SEND_STATUS, | |
| 300 SAVE_TO_WALLET, | 258 SAVE_TO_WALLET, |
| 301 }; | 259 }; |
| 302 | 260 |
| 303 // For measuring the frequency of errors while communicating with the Wallet | 261 // For measuring the frequency of errors while communicating with the Wallet |
| 304 // server. | 262 // server. |
| 305 enum WalletErrorMetric { | 263 enum WalletErrorMetric { |
| 306 // Baseline metric: Issued a request to the Wallet server. | 264 // Baseline metric: Issued a request to the Wallet server. |
| 307 WALLET_ERROR_BASELINE_ISSUED_REQUEST = 0, | 265 WALLET_ERROR_BASELINE_ISSUED_REQUEST = 0, |
| 308 // A fatal error occured while communicating with the Wallet server. This | 266 // A fatal error occured while communicating with the Wallet server. This |
| 309 // value has been deprecated. | 267 // value has been deprecated. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 ACCEPT_TOS, | 313 ACCEPT_TOS, |
| 356 UPDATE_EXPIRATION_DATE, | 314 UPDATE_EXPIRATION_DATE, |
| 357 UPGRADE_MIN_ADDRESS, | 315 UPGRADE_MIN_ADDRESS, |
| 358 CHOOSE_ANOTHER_INSTRUMENT_OR_ADDRESS, | 316 CHOOSE_ANOTHER_INSTRUMENT_OR_ADDRESS, |
| 359 VERIFY_CVV, | 317 VERIFY_CVV, |
| 360 INVALID_FORM_FIELD, | 318 INVALID_FORM_FIELD, |
| 361 REQUIRE_PHONE_NUMBER, | 319 REQUIRE_PHONE_NUMBER, |
| 362 NUM_WALLET_REQUIRED_ACTIONS | 320 NUM_WALLET_REQUIRED_ACTIONS |
| 363 }; | 321 }; |
| 364 | 322 |
| 365 // The success or failure of downloading Autocheckout whitelist file. | |
| 366 enum AutocheckoutWhitelistDownloadStatus { | |
| 367 AUTOCHECKOUT_WHITELIST_DOWNLOAD_FAILED, | |
| 368 AUTOCHECKOUT_WHITELIST_DOWNLOAD_SUCCEEDED, | |
| 369 }; | |
| 370 | |
| 371 AutofillMetrics(); | 323 AutofillMetrics(); |
| 372 virtual ~AutofillMetrics(); | 324 virtual ~AutofillMetrics(); |
| 373 | 325 |
| 374 // Logs how the user interacted with the Autocheckout bubble. | |
| 375 virtual void LogAutocheckoutBubbleMetric(BubbleMetric metric) const; | |
| 376 | |
| 377 // Logs the result of an Autocheckout buy flow. | |
| 378 virtual void LogAutocheckoutBuyFlowMetric( | |
| 379 AutocheckoutBuyFlowMetric metric) const; | |
| 380 | |
| 381 virtual void LogCreditCardInfoBarMetric(InfoBarMetric metric) const; | 326 virtual void LogCreditCardInfoBarMetric(InfoBarMetric metric) const; |
| 382 | 327 |
| 383 virtual void LogDeveloperEngagementMetric( | 328 virtual void LogDeveloperEngagementMetric( |
| 384 DeveloperEngagementMetric metric) const; | 329 DeveloperEngagementMetric metric) const; |
| 385 | 330 |
| 386 virtual void LogHeuristicTypePrediction( | 331 virtual void LogHeuristicTypePrediction( |
| 387 FieldTypeQualityMetric metric, | 332 FieldTypeQualityMetric metric, |
| 388 ServerFieldType field_type, | 333 ServerFieldType field_type, |
| 389 const std::string& experiment_id) const; | 334 const std::string& experiment_id) const; |
| 390 virtual void LogOverallTypePrediction( | 335 virtual void LogOverallTypePrediction( |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 // Logs the network request time of Wallet API calls. | 392 // Logs the network request time of Wallet API calls. |
| 448 virtual void LogWalletApiCallDuration( | 393 virtual void LogWalletApiCallDuration( |
| 449 WalletApiCallMetric metric, | 394 WalletApiCallMetric metric, |
| 450 const base::TimeDelta& duration) const; | 395 const base::TimeDelta& duration) const; |
| 451 | 396 |
| 452 // Logs |required_action| to the required actions histogram for |dialog_type|. | 397 // Logs |required_action| to the required actions histogram for |dialog_type|. |
| 453 virtual void LogWalletRequiredActionMetric( | 398 virtual void LogWalletRequiredActionMetric( |
| 454 autofill::DialogType dialog_type, | 399 autofill::DialogType dialog_type, |
| 455 WalletRequiredActionMetric required_action) const; | 400 WalletRequiredActionMetric required_action) const; |
| 456 | 401 |
| 457 virtual void LogAutocheckoutDuration( | |
| 458 const base::TimeDelta& duration, | |
| 459 AutocheckoutCompletionStatus status) const; | |
| 460 | |
| 461 // Logs the time taken to download Autocheckout whitelist file. | |
| 462 virtual void LogAutocheckoutWhitelistDownloadDuration( | |
| 463 const base::TimeDelta& duration, | |
| 464 AutocheckoutWhitelistDownloadStatus status) const; | |
| 465 | |
| 466 // This should be called when a form that has been Autofilled is submitted. | 402 // This should be called when a form that has been Autofilled is submitted. |
| 467 // |duration| should be the time elapsed between form load and submission. | 403 // |duration| should be the time elapsed between form load and submission. |
| 468 virtual void LogFormFillDurationFromLoadWithAutofill( | 404 virtual void LogFormFillDurationFromLoadWithAutofill( |
| 469 const base::TimeDelta& duration) const; | 405 const base::TimeDelta& duration) const; |
| 470 | 406 |
| 471 // This should be called when a fillable form that has not been Autofilled is | 407 // This should be called when a fillable form that has not been Autofilled is |
| 472 // submitted. |duration| should be the time elapsed between form load and | 408 // submitted. |duration| should be the time elapsed between form load and |
| 473 // submission. | 409 // submission. |
| 474 virtual void LogFormFillDurationFromLoadWithoutAutofill( | 410 virtual void LogFormFillDurationFromLoadWithoutAutofill( |
| 475 const base::TimeDelta& duration) const; | 411 const base::TimeDelta& duration) const; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 virtual void LogServerExperimentIdForUpload( | 443 virtual void LogServerExperimentIdForUpload( |
| 508 const std::string& experiment_id) const; | 444 const std::string& experiment_id) const; |
| 509 | 445 |
| 510 private: | 446 private: |
| 511 DISALLOW_COPY_AND_ASSIGN(AutofillMetrics); | 447 DISALLOW_COPY_AND_ASSIGN(AutofillMetrics); |
| 512 }; | 448 }; |
| 513 | 449 |
| 514 } // namespace autofill | 450 } // namespace autofill |
| 515 | 451 |
| 516 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ | 452 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_METRICS_H_ |
| OLD | NEW |