| 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 77442395f201073a68feac7dc21890f545343393..b85a401d80acb274a2f32a06ead4690120bce421 100644
|
| --- a/components/autofill/core/browser/autofill_metrics.cc
|
| +++ b/components/autofill/core/browser/autofill_metrics.cc
|
| @@ -31,6 +31,7 @@ const char kUKMInteractedWithFormEntryName[] = "Autofill.InteractedWithForm";
|
| const char kUKMIsForCreditCardMetricName[] = "IsForCreditCard";
|
| const char kUKMLocalRecordTypeCountMetricName[] = "LocalRecordTypeCount";
|
| const char kUKMServerRecordTypeCountMetricName[] = "ServerRecordTypeCount";
|
| +const char kUKMPollSuggestionsEntryName[] = "PollSuggestions";
|
| const char kUKMSuggestionsShownEntryName[] = "Autofill.SuggestionsShown";
|
| const char kUKMSelectedMaskedServerCardEntryName[] =
|
| "Autofill.SelectedMaskedServerCard";
|
| @@ -804,12 +805,15 @@ void AutofillMetrics::FormEventLogger::OnDidInteractWithAutofillableForm() {
|
| }
|
|
|
| void AutofillMetrics::FormEventLogger::OnDidPollSuggestions(
|
| - const FormFieldData& field) {
|
| + const FormFieldData& field,
|
| + const AutofillField& autofill_field) {
|
| // Record only one poll user action for consecutive polls of the same field.
|
| // This is to avoid recording too many poll actions (for example when a user
|
| // types in a field, triggering multiple queries) to make the analysis more
|
| // simple.
|
| if (!field.SameFieldAs(last_polled_field_)) {
|
| + form_interactions_ukm_logger_->LogPollSuggestions(autofill_field);
|
| +
|
| if (is_for_credit_card_) {
|
| base::RecordAction(
|
| base::UserMetricsAction("Autofill_PolledCreditCardSuggestions"));
|
| @@ -1028,6 +1032,26 @@ void AutofillMetrics::FormInteractionsUkmLogger::LogInteractedWithForm(
|
| server_record_type_count);
|
| }
|
|
|
| +void AutofillMetrics::FormInteractionsUkmLogger::LogPollSuggestions(
|
| + const AutofillField& field) {
|
| + if (!CanLog())
|
| + return;
|
| +
|
| + if (source_id_ == -1)
|
| + GetNewSourceID();
|
| +
|
| + std::unique_ptr<ukm::UkmEntryBuilder> builder = ukm_service_->GetEntryBuilder(
|
| + source_id_, internal::kUKMPollSuggestionsEntryName);
|
| + builder->AddMetric(internal::kUKMMillisecondsSinceFormLoadedMetricName,
|
| + MillisecondsSinceFormLoaded());
|
| + builder->AddMetric(internal::kUKMHeuristicTypeMetricName,
|
| + static_cast<int>(field.heuristic_type()));
|
| + builder->AddMetric(internal::kUKMServerTypeMetricName,
|
| + static_cast<int>(field.server_type()));
|
| + builder->AddMetric(internal::kUKMHtmlFieldTypeMetricName,
|
| + static_cast<int>(field.html_type()));
|
| +}
|
| +
|
| void AutofillMetrics::FormInteractionsUkmLogger::LogSuggestionsShown() {
|
| if (!CanLog())
|
| return;
|
|
|