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

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

Issue 2899313002: [Payments] Move the logging for checkout flow to native. (Closed)
Patch Set: Addressed 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 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 void JourneyLogger::SetCanMakePaymentValue(bool value) { 100 void JourneyLogger::SetCanMakePaymentValue(bool value) {
101 was_can_make_payments_used_ = true; 101 was_can_make_payments_used_ = true;
102 could_make_payment_ |= value; 102 could_make_payment_ |= value;
103 } 103 }
104 104
105 void JourneyLogger::SetShowCalled() { 105 void JourneyLogger::SetShowCalled() {
106 was_show_called_ = true; 106 was_show_called_ = true;
107 } 107 }
108 108
109 void JourneyLogger::SetCompleted() {
110 UMA_HISTOGRAM_BOOLEAN("PaymentRequest.CheckoutFunnel.Completed", true);
111
112 RecordJourneyStatsHistograms(COMPLETION_STATUS_COMPLETED);
113 }
114
115 void JourneyLogger::SetAborted(AbortReason reason) {
116 base::UmaHistogramEnumeration("PaymentRequest.CheckoutFunnel.Aborted", reason,
117 ABORT_REASON_MAX);
118
119 if (reason == ABORT_REASON_ABORTED_BY_USER)
120 RecordJourneyStatsHistograms(COMPLETION_STATUS_USER_ABORTED);
121 else
122 RecordJourneyStatsHistograms(COMPLETION_STATUS_OTHER_ABORTED);
123 }
124
125 #ifdef OS_ANDROID
126 void JourneyLogger::SetNotShown(NotShownReason reason) {
127 base::UmaHistogramEnumeration("PaymentRequest.CheckoutFunnel.NoShow", reason,
128 NOT_SHOWN_REASON_MAX);
129
130 // Record that that Payment Request was initiated here, because nothing else
131 // will be recorded for a Payment Request that was not shown to the user.
132 UMA_HISTOGRAM_BOOLEAN("PaymentRequest.CheckoutFunnel.Initiated", true);
133 }
134 #endif
135
109 void JourneyLogger::SetEventOccurred(Event event) { 136 void JourneyLogger::SetEventOccurred(Event event) {
110 events_ |= event; 137 events_ |= event;
111 } 138 }
112 139
113 void JourneyLogger::RecordJourneyStatsHistograms( 140 void JourneyLogger::RecordJourneyStatsHistograms(
114 CompletionStatus completion_status) { 141 CompletionStatus completion_status) {
115 DCHECK(!has_recorded_); 142 DCHECK(!has_recorded_);
116 has_recorded_ = true; 143 has_recorded_ = true;
117 144
118 RecordCheckoutFlowMetrics(); 145 RecordCheckoutFlowMetrics();
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 ukm_recorder_->UpdateSourceURL(source_id, url_); 277 ukm_recorder_->UpdateSourceURL(source_id, url_);
251 std::unique_ptr<ukm::UkmEntryBuilder> builder = 278 std::unique_ptr<ukm::UkmEntryBuilder> builder =
252 ukm_recorder_->GetEntryBuilder(source_id, 279 ukm_recorder_->GetEntryBuilder(source_id,
253 internal::kUKMCheckoutEventsEntryName); 280 internal::kUKMCheckoutEventsEntryName);
254 builder->AddMetric(internal::kUKMCompletionStatusMetricName, 281 builder->AddMetric(internal::kUKMCompletionStatusMetricName,
255 completion_status); 282 completion_status);
256 builder->AddMetric(internal::kUKMEventsMetricName, events_); 283 builder->AddMetric(internal::kUKMEventsMetricName, events_);
257 } 284 }
258 285
259 } // namespace payments 286 } // namespace payments
OLDNEW
« no previous file with comments | « components/payments/core/journey_logger.h ('k') | components/payments/core/journey_logger_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698