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

Side by Side Diff: components/payments/core/journey_logger.cc

Issue 2874413004: [Autofill] Enable Autofill UKM by default. (Closed)
Patch Set: Removed unnecessary includes 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/payments/core/journey_logger.h" 5 #include "components/payments/core/journey_logger.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/metrics/histogram_functions.h" 9 #include "base/metrics/histogram_functions.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
11 #include "components/autofill/core/browser/autofill_experiments.h"
12 #include "components/ukm/ukm_entry_builder.h" 11 #include "components/ukm/ukm_entry_builder.h"
13 #include "components/ukm/ukm_service.h" 12 #include "components/ukm/ukm_service.h"
14 13
15 namespace payments { 14 namespace payments {
16 15
17 namespace internal { 16 namespace internal {
18 extern const char kUKMCheckoutEventsEntryName[] = 17 extern const char kUKMCheckoutEventsEntryName[] =
19 "PaymentRequest.CheckoutEvents"; 18 "PaymentRequest.CheckoutEvents";
20 extern const char kUKMCompletionStatusMetricName[] = "CompletionStatus"; 19 extern const char kUKMCompletionStatusMetricName[] = "CompletionStatus";
21 extern const char kUKMEventsMetricName[] = "Events"; 20 extern const char kUKMEventsMetricName[] = "Events";
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 histogram_name += "Used.TrueWithShowEffectOnCompletion"; 213 histogram_name += "Used.TrueWithShowEffectOnCompletion";
215 } else { 214 } else {
216 histogram_name += "Used.FalseWithShowEffectOnCompletion"; 215 histogram_name += "Used.FalseWithShowEffectOnCompletion";
217 } 216 }
218 217
219 base::UmaHistogramEnumeration(histogram_name, completion_status, 218 base::UmaHistogramEnumeration(histogram_name, completion_status,
220 COMPLETION_STATUS_MAX); 219 COMPLETION_STATUS_MAX);
221 } 220 }
222 221
223 void JourneyLogger::RecordUrlKeyedMetrics(CompletionStatus completion_status) { 222 void JourneyLogger::RecordUrlKeyedMetrics(CompletionStatus completion_status) {
224 if (!autofill::IsUkmLoggingEnabled() || !ukm_service_ || !url_.is_valid()) 223 if (!ukm_service_ || !url_.is_valid())
225 return; 224 return;
226 225
227 // Record the Checkout Funnel UKM. 226 // Record the Checkout Funnel UKM.
228 int32_t source_id = ukm_service_->GetNewSourceID(); 227 int32_t source_id = ukm_service_->GetNewSourceID();
229 ukm_service_->UpdateSourceURL(source_id, url_); 228 ukm_service_->UpdateSourceURL(source_id, url_);
230 std::unique_ptr<ukm::UkmEntryBuilder> builder = ukm_service_->GetEntryBuilder( 229 std::unique_ptr<ukm::UkmEntryBuilder> builder = ukm_service_->GetEntryBuilder(
231 source_id, internal::kUKMCheckoutEventsEntryName); 230 source_id, internal::kUKMCheckoutEventsEntryName);
232 builder->AddMetric(internal::kUKMCompletionStatusMetricName, 231 builder->AddMetric(internal::kUKMCompletionStatusMetricName,
233 completion_status); 232 completion_status);
234 builder->AddMetric(internal::kUKMEventsMetricName, events_); 233 builder->AddMetric(internal::kUKMEventsMetricName, events_);
235 } 234 }
236 235
237 } // namespace payments 236 } // namespace payments
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_metrics_unittest.cc ('k') | components/payments/core/journey_logger_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698