OLD | NEW |
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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 histogram_name += "Used.TrueWithShowEffectOnCompletion"; | 216 histogram_name += "Used.TrueWithShowEffectOnCompletion"; |
218 } else { | 217 } else { |
219 histogram_name += "Used.FalseWithShowEffectOnCompletion"; | 218 histogram_name += "Used.FalseWithShowEffectOnCompletion"; |
220 } | 219 } |
221 | 220 |
222 base::UmaHistogramEnumeration(histogram_name, completion_status, | 221 base::UmaHistogramEnumeration(histogram_name, completion_status, |
223 COMPLETION_STATUS_MAX); | 222 COMPLETION_STATUS_MAX); |
224 } | 223 } |
225 | 224 |
226 void JourneyLogger::RecordUrlKeyedMetrics(CompletionStatus completion_status) { | 225 void JourneyLogger::RecordUrlKeyedMetrics(CompletionStatus completion_status) { |
227 if (!autofill::IsUkmLoggingEnabled() || !ukm_service_ || !url_.is_valid()) | 226 if (!ukm_service_ || !url_.is_valid()) |
228 return; | 227 return; |
229 | 228 |
230 // Record the Checkout Funnel UKM. | 229 // Record the Checkout Funnel UKM. |
231 int32_t source_id = ukm_service_->GetNewSourceID(); | 230 int32_t source_id = ukm_service_->GetNewSourceID(); |
232 ukm_service_->UpdateSourceURL(source_id, url_); | 231 ukm_service_->UpdateSourceURL(source_id, url_); |
233 std::unique_ptr<ukm::UkmEntryBuilder> builder = ukm_service_->GetEntryBuilder( | 232 std::unique_ptr<ukm::UkmEntryBuilder> builder = ukm_service_->GetEntryBuilder( |
234 source_id, internal::kUKMCheckoutEventsEntryName); | 233 source_id, internal::kUKMCheckoutEventsEntryName); |
235 builder->AddMetric(internal::kUKMCompletionStatusMetricName, | 234 builder->AddMetric(internal::kUKMCompletionStatusMetricName, |
236 completion_status); | 235 completion_status); |
237 builder->AddMetric(internal::kUKMEventsMetricName, events_); | 236 builder->AddMetric(internal::kUKMEventsMetricName, events_); |
238 } | 237 } |
239 | 238 |
240 } // namespace payments | 239 } // namespace payments |
OLD | NEW |