Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: components/autofill/core/browser/autofill_metrics.cc

Issue 884843002: Recording in UMA when a user interacted with an address form or a credit card form. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: inlining web_profiles() call Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..32ecb8407583fc073f27aa091b9e08c50a5fd4a1 100644
--- a/components/autofill/core/browser/autofill_metrics.cc
+++ b/components/autofill/core/browser/autofill_metrics.cc
@@ -465,4 +465,40 @@ void AutofillMetrics::LogAddressSuggestionsCount(size_t num_suggestions) {
UMA_HISTOGRAM_COUNTS("Autofill.AddressSuggestionsCount", num_suggestions);
}
+AutofillMetrics::FormEventLogger::FormEventLogger(bool is_for_credit_card)
+ : is_for_credit_card_(is_for_credit_card),
+ is_server_data_available_(false),
+ is_local_data_available_(false),
+ has_logged_interacted_(false) {};
+
+void AutofillMetrics::FormEventLogger::OnDidInteractWithAutofillableForm() {
+ if (!has_logged_interacted_) {
+ has_logged_interacted_ = true;
+ Log(AutofillMetrics::FORM_EVENT_INTERACTED_ONCE);
+ }
+}
+
+void AutofillMetrics::FormEventLogger::Log(FormEvent event) const {
+ DCHECK_LT(event, NUM_FORM_EVENTS);
+ std::string name("Autofill.FormEvents.");
+ if (is_for_credit_card_)
+ name += "CreditCard";
+ else
+ name += "Address";
+ LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS);
+
+ // Logging again in a different histogram for segmentation purposes.
+ // TODO(waltercacau): Re-evaluate if we still need such fine grained
+ // segmentation. http://crbug.com/454018
+ if (!is_server_data_available_ && !is_local_data_available_)
+ name += ".WithNoData";
+ else if (is_server_data_available_ && !is_local_data_available_)
+ name += ".WithOnlyServerData";
+ else if (!is_server_data_available_ && is_local_data_available_)
+ name += ".WithOnlyLocalData";
+ else
+ name += ".WithBothServerAndLocalData";
+ LogUMAHistogramEnumeration(name, event, NUM_FORM_EVENTS);
+}
+
} // namespace autofill
« no previous file with comments | « components/autofill/core/browser/autofill_metrics.h ('k') | components/autofill/core/browser/autofill_metrics_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698