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."); |
Evan Stade
2015/01/30 19:39:49
?
Walter Cacau
2015/01/30 22:05:56
ops
old code from when I tried dynamically generat
|
+ 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", |
Evan Stade
2015/01/30 19:39:50
this code could be a bit less verbose --
const ch
Walter Cacau
2015/01/30 22:05:56
So, I actually had code like that but the UMA macr
Evan Stade
2015/01/30 22:35:15
pretty sure you could still do this somehow with m
Ilya Sherman
2015/01/30 22:38:05
Alternately, you can inline the macro definition,
Walter Cacau
2015/01/31 00:35:55
Done.
|
+ 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 |