| Index: components/autofill/core/browser/autofill_metrics.cc
|
| diff --git a/components/autofill/core/browser/autofill_metrics.cc b/components/autofill/core/browser/autofill_metrics.cc
|
| index 21ca9f840d9ecad5624ba2474946b25d9dea0de2..5189dd5274c46c4e59dcee920c09f2907fa383e8 100644
|
| --- a/components/autofill/core/browser/autofill_metrics.cc
|
| +++ b/components/autofill/core/browser/autofill_metrics.cc
|
| @@ -465,4 +465,67 @@ void AutofillMetrics::LogAddressSuggestionsCount(size_t num_suggestions) {
|
| UMA_HISTOGRAM_COUNTS("Autofill.AddressSuggestionsCount", num_suggestions);
|
| }
|
|
|
| +AutofillMetrics::FormEventLogger::FormEventLogger(
|
| + bool is_credit_card,
|
| + bool is_server_data_available,
|
| + bool is_local_data_available)
|
| + : is_credit_card_(is_credit_card),
|
| + is_server_data_available_(is_server_data_available),
|
| + is_local_data_available_(is_local_data_available) {};
|
| +
|
| +void AutofillMetrics::FormEventLogger::Log(AutofillFormEvent event) {
|
| + DCHECK_LT(event, NUM_AUTOFILL_FORM_EVENTS);
|
| + std::string custom_name("Autofill.FormEvents.");
|
| + if (is_credit_card_) {
|
| + UMA_HISTOGRAM_ENUMERATION("Autofill.FormEvents.CreditCard", event,
|
| + NUM_AUTOFILL_FORM_EVENTS);
|
| + } else {
|
| + UMA_HISTOGRAM_ENUMERATION("Autofill.FormEvents.Address", event,
|
| + NUM_AUTOFILL_FORM_EVENTS);
|
| + }
|
| +
|
| + // Logging again in a different histogram for segmentation purposes.
|
| + if (!is_server_data_available_ && !is_local_data_available_) {
|
| + if (is_credit_card_) {
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + "Autofill.FormEvents.CreditCard.WithNoData",
|
| + event, NUM_AUTOFILL_FORM_EVENTS);
|
| + } else {
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + "Autofill.FormEvents.Address.WithNoData",
|
| + event, NUM_AUTOFILL_FORM_EVENTS);
|
| + }
|
| + } else if (is_server_data_available_ && !is_local_data_available_) {
|
| + if (is_credit_card_) {
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + "Autofill.FormEvents.CreditCard.WithOnlyServerData",
|
| + event, NUM_AUTOFILL_FORM_EVENTS);
|
| + } else {
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + "Autofill.FormEvents.Address.WithOnlyServerData",
|
| + event, NUM_AUTOFILL_FORM_EVENTS);
|
| + }
|
| + } else if (!is_server_data_available_ && is_local_data_available_) {
|
| + if (is_credit_card_) {
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + "Autofill.FormEvents.CreditCard.WithOnlyLocalData",
|
| + event, NUM_AUTOFILL_FORM_EVENTS);
|
| + } else {
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + "Autofill.FormEvents.Address.WithOnlyLocalData",
|
| + event, NUM_AUTOFILL_FORM_EVENTS);
|
| + }
|
| + } else {
|
| + if (is_credit_card_) {
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + "Autofill.FormEvents.CreditCard.WithBothServerAndLocalData",
|
| + event, NUM_AUTOFILL_FORM_EVENTS);
|
| + } else {
|
| + UMA_HISTOGRAM_ENUMERATION(
|
| + "Autofill.FormEvents.Address.WithBothServerAndLocalData",
|
| + event, NUM_AUTOFILL_FORM_EVENTS);
|
| + }
|
| + }
|
| +}
|
| +
|
| } // namespace autofill
|
|
|