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

Side by Side Diff: components/autofill/core/browser/autofill_metrics.cc

Issue 2839063004: [Autofill] UKM for suggestions polled field. (Closed)
Patch Set: Address comments Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/core/browser/autofill_metrics.h" 5 #include "components/autofill/core/browser/autofill_metrics.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 base::UserMetricsAction("Autofill_PolledCreditCardSuggestions")); 849 base::UserMetricsAction("Autofill_PolledCreditCardSuggestions"));
850 } else { 850 } else {
851 base::RecordAction( 851 base::RecordAction(
852 base::UserMetricsAction("Autofill_PolledProfileSuggestions")); 852 base::UserMetricsAction("Autofill_PolledProfileSuggestions"));
853 } 853 }
854 854
855 last_polled_field_ = field; 855 last_polled_field_ = field;
856 } 856 }
857 } 857 }
858 858
859 void AutofillMetrics::FormEventLogger::OnDidShowSuggestions() { 859 void AutofillMetrics::FormEventLogger::OnDidShowSuggestions(
860 form_interactions_ukm_logger_->LogSuggestionsShown(); 860 const AutofillField& field) {
861 form_interactions_ukm_logger_->LogSuggestionsShown(field);
861 862
862 Log(AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN); 863 Log(AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN);
863 if (!has_logged_suggestions_shown_) { 864 if (!has_logged_suggestions_shown_) {
864 has_logged_suggestions_shown_ = true; 865 has_logged_suggestions_shown_ = true;
865 Log(AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE); 866 Log(AutofillMetrics::FORM_EVENT_SUGGESTIONS_SHOWN_ONCE);
866 } 867 }
867 868
868 if (is_for_credit_card_) { 869 if (is_for_credit_card_) {
869 base::RecordAction( 870 base::RecordAction(
870 base::UserMetricsAction("Autofill_ShowedCreditCardSuggestions")); 871 base::UserMetricsAction("Autofill_ShowedCreditCardSuggestions"));
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 ukm_recorder_->GetEntryBuilder(source_id_, 1057 ukm_recorder_->GetEntryBuilder(source_id_,
1057 internal::kUKMInteractedWithFormEntryName); 1058 internal::kUKMInteractedWithFormEntryName);
1058 builder->AddMetric(internal::kUKMIsForCreditCardMetricName, 1059 builder->AddMetric(internal::kUKMIsForCreditCardMetricName,
1059 is_for_credit_card); 1060 is_for_credit_card);
1060 builder->AddMetric(internal::kUKMLocalRecordTypeCountMetricName, 1061 builder->AddMetric(internal::kUKMLocalRecordTypeCountMetricName,
1061 local_record_type_count); 1062 local_record_type_count);
1062 builder->AddMetric(internal::kUKMServerRecordTypeCountMetricName, 1063 builder->AddMetric(internal::kUKMServerRecordTypeCountMetricName,
1063 server_record_type_count); 1064 server_record_type_count);
1064 } 1065 }
1065 1066
1066 void AutofillMetrics::FormInteractionsUkmLogger::LogSuggestionsShown() { 1067 void AutofillMetrics::FormInteractionsUkmLogger::LogSuggestionsShown(
1068 const AutofillField& field) {
1067 if (!CanLog()) 1069 if (!CanLog())
1068 return; 1070 return;
1069 1071
1070 if (source_id_ == -1) 1072 if (source_id_ == -1)
1071 GetNewSourceID(); 1073 GetNewSourceID();
1072 1074
1073 std::unique_ptr<ukm::UkmEntryBuilder> builder = 1075 std::unique_ptr<ukm::UkmEntryBuilder> builder =
1074 ukm_recorder_->GetEntryBuilder(source_id_, 1076 ukm_recorder_->GetEntryBuilder(source_id_,
1075 internal::kUKMSuggestionsShownEntryName); 1077 internal::kUKMSuggestionsShownEntryName);
1078 builder->AddMetric(internal::kUKMHeuristicTypeMetricName,
1079 static_cast<int>(field.heuristic_type()));
1080 builder->AddMetric(internal::kUKMHtmlFieldTypeMetricName,
1081 static_cast<int>(field.html_type()));
1082 builder->AddMetric(internal::kUKMServerTypeMetricName,
1083 static_cast<int>(field.server_type()));
1076 builder->AddMetric(internal::kUKMMillisecondsSinceFormParsedMetricName, 1084 builder->AddMetric(internal::kUKMMillisecondsSinceFormParsedMetricName,
1077 MillisecondsSinceFormParsed()); 1085 MillisecondsSinceFormParsed());
1078 } 1086 }
1079 1087
1080 void AutofillMetrics::FormInteractionsUkmLogger::LogSelectedMaskedServerCard() { 1088 void AutofillMetrics::FormInteractionsUkmLogger::LogSelectedMaskedServerCard() {
1081 if (!CanLog()) 1089 if (!CanLog())
1082 return; 1090 return;
1083 1091
1084 if (source_id_ == -1) 1092 if (source_id_ == -1)
1085 GetNewSourceID(); 1093 GetNewSourceID();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 DCHECK(!form_parsed_timestamp_.is_null()); 1181 DCHECK(!form_parsed_timestamp_.is_null());
1174 return (base::TimeTicks::Now() - form_parsed_timestamp_).InMilliseconds(); 1182 return (base::TimeTicks::Now() - form_parsed_timestamp_).InMilliseconds();
1175 } 1183 }
1176 1184
1177 void AutofillMetrics::FormInteractionsUkmLogger::GetNewSourceID() { 1185 void AutofillMetrics::FormInteractionsUkmLogger::GetNewSourceID() {
1178 source_id_ = ukm_recorder_->GetNewSourceID(); 1186 source_id_ = ukm_recorder_->GetNewSourceID();
1179 ukm_recorder_->UpdateSourceURL(source_id_, url_); 1187 ukm_recorder_->UpdateSourceURL(source_id_, url_);
1180 } 1188 }
1181 1189
1182 } // namespace autofill 1190 } // namespace autofill
OLDNEW
« 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