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

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

Issue 2892833002: [Payments] Use event to log checkout funnel metrics. (Closed)
Patch Set: Nit 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
« no previous file with comments | « components/payments/core/journey_logger.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 void JourneyLogger::SetEventOccurred(Event event) { 110 void JourneyLogger::SetEventOccurred(Event event) {
111 events_ |= event; 111 events_ |= event;
112 } 112 }
113 113
114 void JourneyLogger::RecordJourneyStatsHistograms( 114 void JourneyLogger::RecordJourneyStatsHistograms(
115 CompletionStatus completion_status) { 115 CompletionStatus completion_status) {
116 DCHECK(!has_recorded_); 116 DCHECK(!has_recorded_);
117 has_recorded_ = true; 117 has_recorded_ = true;
118 118
119 RecordCheckoutFlowMetrics();
120
119 RecordSectionSpecificStats(completion_status); 121 RecordSectionSpecificStats(completion_status);
120 122
121 // Record the CanMakePayment metrics based on whether the transaction was 123 // Record the CanMakePayment metrics based on whether the transaction was
122 // completed or aborted by the user (UserAborted) or otherwise (OtherAborted). 124 // completed or aborted by the user (UserAborted) or otherwise (OtherAborted).
123 RecordCanMakePaymentStats(completion_status); 125 RecordCanMakePaymentStats(completion_status);
124 126
125 RecordUrlKeyedMetrics(completion_status); 127 RecordUrlKeyedMetrics(completion_status);
126 } 128 }
127 129
130 void JourneyLogger::RecordCheckoutFlowMetrics() {
131 UMA_HISTOGRAM_BOOLEAN("PaymentRequest.CheckoutFunnel.Initiated", true);
132
133 if (events_ & EVENT_SHOWN)
134 UMA_HISTOGRAM_BOOLEAN("PaymentRequest.CheckoutFunnel.Shown", true);
135
136 if (events_ & EVENT_PAY_CLICKED)
137 UMA_HISTOGRAM_BOOLEAN("PaymentRequest.CheckoutFunnel.PayClicked", true);
138
139 if (events_ & EVENT_RECEIVED_INSTRUMENT_DETAILS)
140 UMA_HISTOGRAM_BOOLEAN(
141 "PaymentRequest.CheckoutFunnel.ReceivedInstrumentDetails", true);
142
143 if (events_ & EVENT_SKIPPED_SHOW)
144 UMA_HISTOGRAM_BOOLEAN("PaymentRequest.CheckoutFunnel.SkippedShow", true);
145 }
146
128 void JourneyLogger::RecordSectionSpecificStats( 147 void JourneyLogger::RecordSectionSpecificStats(
129 CompletionStatus completion_status) { 148 CompletionStatus completion_status) {
130 // Record whether the user had suggestions for each requested information. 149 // Record whether the user had suggestions for each requested information.
131 bool user_had_all_requested_information = true; 150 bool user_had_all_requested_information = true;
132 151
133 for (int i = 0; i < NUMBER_OF_SECTIONS; ++i) { 152 for (int i = 0; i < NUMBER_OF_SECTIONS; ++i) {
134 std::string name_suffix = GetHistogramNameSuffix(i, completion_status); 153 std::string name_suffix = GetHistogramNameSuffix(i, completion_status);
135 154
136 // Only log the metrics for a section if it was requested by the merchant. 155 // Only log the metrics for a section if it was requested by the merchant.
137 if (sections_[i].is_requested_) { 156 if (sections_[i].is_requested_) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 int32_t source_id = ukm_service_->GetNewSourceID(); 250 int32_t source_id = ukm_service_->GetNewSourceID();
232 ukm_service_->UpdateSourceURL(source_id, url_); 251 ukm_service_->UpdateSourceURL(source_id, url_);
233 std::unique_ptr<ukm::UkmEntryBuilder> builder = ukm_service_->GetEntryBuilder( 252 std::unique_ptr<ukm::UkmEntryBuilder> builder = ukm_service_->GetEntryBuilder(
234 source_id, internal::kUKMCheckoutEventsEntryName); 253 source_id, internal::kUKMCheckoutEventsEntryName);
235 builder->AddMetric(internal::kUKMCompletionStatusMetricName, 254 builder->AddMetric(internal::kUKMCompletionStatusMetricName,
236 completion_status); 255 completion_status);
237 builder->AddMetric(internal::kUKMEventsMetricName, events_); 256 builder->AddMetric(internal::kUKMEventsMetricName, events_);
238 } 257 }
239 258
240 } // namespace payments 259 } // namespace payments
OLDNEW
« no previous file with comments | « components/payments/core/journey_logger.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698