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

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

Issue 2800853004: UKM that threads together multiple form interaction events. (Closed)
Patch Set: Logs each form interaction event in a separate UkmEntry, includes time_delta as a metric. Created 3 years, 8 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/form_structure.cc
diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc
index 0896bb4f426772e8c846870d22bb5f84da1741c0..85e9a2d1680cc71d3a19f543e904194cd98bd05e 100644
--- a/components/autofill/core/browser/form_structure.cc
+++ b/components/autofill/core/browser/form_structure.cc
@@ -9,6 +9,7 @@
#include <algorithm>
#include <map>
#include <utility>
+#include <vector>
#include "base/command_line.h"
#include "base/i18n/case_conversion.h"
@@ -363,23 +364,25 @@ void FormStructure::DetermineHeuristicTypes(ukm::UkmService* ukm_service) {
UpdateAutofillCount();
IdentifySections(has_author_specified_sections_);
+ std::vector<AutofillMetrics::DeveloperEngagementMetric> metrics;
if (IsAutofillable()) {
- const auto metric =
+ AutofillMetrics::DeveloperEngagementMetric metric =
has_author_specified_types_
? AutofillMetrics::FILLABLE_FORM_PARSED_WITH_TYPE_HINTS
: AutofillMetrics::FILLABLE_FORM_PARSED_WITHOUT_TYPE_HINTS;
+ metrics.push_back(metric);
AutofillMetrics::LogDeveloperEngagementMetric(metric);
- AutofillMetrics::LogDeveloperEngagementUkm(ukm_service, source_url(),
- metric);
}
if (has_author_specified_upi_vpa_hint_) {
AutofillMetrics::LogDeveloperEngagementMetric(
AutofillMetrics::FORM_CONTAINS_UPI_VPA_HINT);
- AutofillMetrics::LogDeveloperEngagementUkm(
- ukm_service, source_url(), AutofillMetrics::FORM_CONTAINS_UPI_VPA_HINT);
+ metrics.push_back(AutofillMetrics::FORM_CONTAINS_UPI_VPA_HINT);
}
+ AutofillMetrics::LogDeveloperEngagementUkm(ukm_service, source_url(),
+ metrics);
+
AutofillMetrics::LogDetermineHeuristicTypesTiming(
base::TimeTicks::Now() - determine_heuristic_types_start_time);
}
@@ -681,12 +684,14 @@ void FormStructure::UpdateFromCache(const FormStructure& cached_form,
form_signature_ = cached_form.form_signature_;
}
-void FormStructure::LogQualityMetrics(const base::TimeTicks& load_time,
- const base::TimeTicks& interaction_time,
- const base::TimeTicks& submission_time,
- rappor::RapporServiceImpl* rappor_service,
- bool did_show_suggestions,
- bool observed_submission) const {
+void FormStructure::LogQualityMetrics(
+ const base::TimeTicks& load_time,
+ const base::TimeTicks& interaction_time,
+ const base::TimeTicks& submission_time,
+ rappor::RapporServiceImpl* rappor_service,
+ AutofillMetrics::FormInteractionsUkmLogger* form_interactions_ukm_logger,
+ bool did_show_suggestions,
+ bool observed_submission) const {
size_t num_detected_field_types = 0;
size_t num_server_mismatches = 0;
size_t num_heuristic_mismatches = 0;
@@ -792,24 +797,20 @@ void FormStructure::LogQualityMetrics(const base::TimeTicks& load_time,
// We log "submission" and duration metrics if we are here after observing a
// submission event.
if (observed_submission) {
+ AutofillMetrics::AutofillFormSubmittedState state;
if (num_detected_field_types < kRequiredFieldsForPredictionRoutines) {
- AutofillMetrics::LogAutofillFormSubmittedState(
- AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA);
+ state = AutofillMetrics::NON_FILLABLE_FORM_OR_NEW_DATA;
} else {
if (did_autofill_all_possible_fields) {
- AutofillMetrics::LogAutofillFormSubmittedState(
- AutofillMetrics::FILLABLE_FORM_AUTOFILLED_ALL);
+ state = AutofillMetrics::FILLABLE_FORM_AUTOFILLED_ALL;
} else if (did_autofill_some_possible_fields) {
- AutofillMetrics::LogAutofillFormSubmittedState(
- AutofillMetrics::FILLABLE_FORM_AUTOFILLED_SOME);
+ state = AutofillMetrics::FILLABLE_FORM_AUTOFILLED_SOME;
} else if (!did_show_suggestions) {
- AutofillMetrics::LogAutofillFormSubmittedState(
- AutofillMetrics::
- FILLABLE_FORM_AUTOFILLED_NONE_DID_NOT_SHOW_SUGGESTIONS);
+ state = AutofillMetrics::
+ FILLABLE_FORM_AUTOFILLED_NONE_DID_NOT_SHOW_SUGGESTIONS;
} else {
- AutofillMetrics::LogAutofillFormSubmittedState(
- AutofillMetrics::
- FILLABLE_FORM_AUTOFILLED_NONE_DID_SHOW_SUGGESTIONS);
+ state =
+ AutofillMetrics::FILLABLE_FORM_AUTOFILLED_NONE_DID_SHOW_SUGGESTIONS;
}
// Log some RAPPOR metrics for problematic cases.
@@ -856,6 +857,10 @@ void FormStructure::LogQualityMetrics(const base::TimeTicks& load_time,
}
}
}
+ if (form_interactions_ukm_logger->url() != source_url())
+ form_interactions_ukm_logger->set_url(source_url());
+ AutofillMetrics::LogAutofillFormSubmittedState(
+ state, form_interactions_ukm_logger);
}
}

Powered by Google App Engine
This is Rietveld 408576698