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

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

Issue 2923243003: Merge-60 [Payments] Move the RequestedInformation metric to native. (Closed)
Patch Set: Created 3 years, 6 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 void JourneyLogger::SetEventOccurred(Event event) { 136 void JourneyLogger::SetEventOccurred(Event event) {
137 events_ |= event; 137 events_ |= event;
138 } 138 }
139 139
140 void JourneyLogger::SetSelectedPaymentMethod( 140 void JourneyLogger::SetSelectedPaymentMethod(
141 SelectedPaymentMethod payment_method) { 141 SelectedPaymentMethod payment_method) {
142 payment_method_ = payment_method; 142 payment_method_ = payment_method;
143 } 143 }
144 144
145 void JourneyLogger::SetRequestedInformation(bool requested_shipping,
146 bool requested_email,
147 bool requested_phone,
148 bool requested_name) {
149 // This method should only be called once per Payment Request.
150 DCHECK(requested_information_ == REQUESTED_INFORMATION_MAX);
151
152 requested_information_ =
153 (requested_shipping ? REQUESTED_INFORMATION_SHIPPING : 0) |
154 (requested_email ? REQUESTED_INFORMATION_EMAIL : 0) |
155 (requested_phone ? REQUESTED_INFORMATION_PHONE : 0) |
156 (requested_name ? REQUESTED_INFORMATION_NAME : 0);
157 }
158
145 void JourneyLogger::RecordJourneyStatsHistograms( 159 void JourneyLogger::RecordJourneyStatsHistograms(
146 CompletionStatus completion_status) { 160 CompletionStatus completion_status) {
147 DCHECK(!has_recorded_); 161 DCHECK(!has_recorded_);
148 has_recorded_ = true; 162 has_recorded_ = true;
149 163
150 RecordCheckoutFlowMetrics(); 164 RecordCheckoutFlowMetrics();
151 165
152 RecordPaymentMethodMetric(); 166 RecordPaymentMethodMetric();
153 167
168 RecordRequestedInformationMetrics();
169
154 RecordSectionSpecificStats(completion_status); 170 RecordSectionSpecificStats(completion_status);
155 171
156 // Record the CanMakePayment metrics based on whether the transaction was 172 // Record the CanMakePayment metrics based on whether the transaction was
157 // completed or aborted by the user (UserAborted) or otherwise (OtherAborted). 173 // completed or aborted by the user (UserAborted) or otherwise (OtherAborted).
158 RecordCanMakePaymentStats(completion_status); 174 RecordCanMakePaymentStats(completion_status);
159 175
160 RecordUrlKeyedMetrics(completion_status); 176 RecordUrlKeyedMetrics(completion_status);
161 } 177 }
162 178
163 void JourneyLogger::RecordCheckoutFlowMetrics() { 179 void JourneyLogger::RecordCheckoutFlowMetrics() {
(...skipping 11 matching lines...) Expand all
175 191
176 if (events_ & EVENT_SKIPPED_SHOW) 192 if (events_ & EVENT_SKIPPED_SHOW)
177 UMA_HISTOGRAM_BOOLEAN("PaymentRequest.CheckoutFunnel.SkippedShow", true); 193 UMA_HISTOGRAM_BOOLEAN("PaymentRequest.CheckoutFunnel.SkippedShow", true);
178 } 194 }
179 195
180 void JourneyLogger::RecordPaymentMethodMetric() { 196 void JourneyLogger::RecordPaymentMethodMetric() {
181 base::UmaHistogramEnumeration("PaymentRequest.SelectedPaymentMethod", 197 base::UmaHistogramEnumeration("PaymentRequest.SelectedPaymentMethod",
182 payment_method_, SELECTED_PAYMENT_METHOD_MAX); 198 payment_method_, SELECTED_PAYMENT_METHOD_MAX);
183 } 199 }
184 200
201 void JourneyLogger::RecordRequestedInformationMetrics() {
202 UMA_HISTOGRAM_ENUMERATION("PaymentRequest.RequestedInformation",
203 requested_information_, REQUESTED_INFORMATION_MAX);
204 }
205
185 void JourneyLogger::RecordSectionSpecificStats( 206 void JourneyLogger::RecordSectionSpecificStats(
186 CompletionStatus completion_status) { 207 CompletionStatus completion_status) {
187 // Record whether the user had suggestions for each requested information. 208 // Record whether the user had suggestions for each requested information.
188 bool user_had_all_requested_information = true; 209 bool user_had_all_requested_information = true;
189 210
190 for (int i = 0; i < NUMBER_OF_SECTIONS; ++i) { 211 for (int i = 0; i < NUMBER_OF_SECTIONS; ++i) {
191 std::string name_suffix = GetHistogramNameSuffix(i, completion_status); 212 std::string name_suffix = GetHistogramNameSuffix(i, completion_status);
192 213
193 // Only log the metrics for a section if it was requested by the merchant. 214 // Only log the metrics for a section if it was requested by the merchant.
194 if (sections_[i].is_requested_) { 215 if (sections_[i].is_requested_) {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 ukm_recorder_->UpdateSourceURL(source_id, url_); 310 ukm_recorder_->UpdateSourceURL(source_id, url_);
290 std::unique_ptr<ukm::UkmEntryBuilder> builder = 311 std::unique_ptr<ukm::UkmEntryBuilder> builder =
291 ukm_recorder_->GetEntryBuilder(source_id, 312 ukm_recorder_->GetEntryBuilder(source_id,
292 internal::kUKMCheckoutEventsEntryName); 313 internal::kUKMCheckoutEventsEntryName);
293 builder->AddMetric(internal::kUKMCompletionStatusMetricName, 314 builder->AddMetric(internal::kUKMCompletionStatusMetricName,
294 completion_status); 315 completion_status);
295 builder->AddMetric(internal::kUKMEventsMetricName, events_); 316 builder->AddMetric(internal::kUKMEventsMetricName, events_);
296 } 317 }
297 318
298 } // namespace payments 319 } // 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