Chromium Code Reviews| 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" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 | 50 |
| 51 DCHECK(!name_suffix.empty()); | 51 DCHECK(!name_suffix.empty()); |
| 52 return name_suffix; | 52 return name_suffix; |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namespace | 55 } // namespace |
| 56 | 56 |
| 57 JourneyLogger::JourneyLogger() | 57 JourneyLogger::JourneyLogger() |
| 58 : was_can_make_payments_used_(false), | 58 : was_can_make_payments_used_(false), |
| 59 could_make_payment_(false), | 59 could_make_payment_(false), |
| 60 was_show_called_(false) {} | 60 was_show_called_(false), |
| 61 is_incognito_(false) {} | |
| 61 | 62 |
| 62 JourneyLogger::~JourneyLogger() {} | 63 JourneyLogger::~JourneyLogger() {} |
| 63 | 64 |
| 64 void JourneyLogger::IncrementSelectionAdds(Section section) { | 65 void JourneyLogger::IncrementSelectionAdds(Section section) { |
| 65 DCHECK_LT(section, SECTION_MAX); | 66 DCHECK_LT(section, SECTION_MAX); |
| 66 sections_[section].number_selection_adds_++; | 67 sections_[section].number_selection_adds_++; |
| 67 } | 68 } |
| 68 | 69 |
| 69 void JourneyLogger::IncrementSelectionChanges(Section section) { | 70 void JourneyLogger::IncrementSelectionChanges(Section section) { |
| 70 DCHECK_LT(section, SECTION_MAX); | 71 DCHECK_LT(section, SECTION_MAX); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 84 | 85 |
| 85 void JourneyLogger::SetCanMakePaymentValue(bool value) { | 86 void JourneyLogger::SetCanMakePaymentValue(bool value) { |
| 86 was_can_make_payments_used_ = true; | 87 was_can_make_payments_used_ = true; |
| 87 could_make_payment_ |= value; | 88 could_make_payment_ |= value; |
| 88 } | 89 } |
| 89 | 90 |
| 90 void JourneyLogger::SetShowCalled() { | 91 void JourneyLogger::SetShowCalled() { |
| 91 was_show_called_ = true; | 92 was_show_called_ = true; |
| 92 } | 93 } |
| 93 | 94 |
| 95 void JourneyLogger::SetIsIncognito() { | |
| 96 is_incognito_ = true; | |
| 97 } | |
| 98 | |
| 94 void JourneyLogger::RecordJourneyStatsHistograms( | 99 void JourneyLogger::RecordJourneyStatsHistograms( |
| 95 CompletionStatus completion_status) { | 100 CompletionStatus completion_status) { |
| 96 RecordSectionSpecificStats(completion_status); | 101 RecordSectionSpecificStats(completion_status); |
| 97 | 102 |
| 98 // Record the CanMakePayment metrics based on whether the transaction was | 103 // Record the CanMakePayment metrics based on whether the transaction was |
| 99 // completed or aborted by the user (UserAborted) or otherwise (OtherAborted). | 104 // completed or aborted by the user (UserAborted) or otherwise (OtherAborted). |
| 100 RecordCanMakePaymentStats(completion_status); | 105 RecordCanMakePaymentStats(completion_status); |
| 101 } | 106 } |
| 102 | 107 |
| 103 void JourneyLogger::RecordSectionSpecificStats( | 108 void JourneyLogger::RecordSectionSpecificStats( |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 } else { | 148 } else { |
| 144 base::UmaHistogramEnumeration( | 149 base::UmaHistogramEnumeration( |
| 145 "PaymentRequest.UserDidNotHaveSuggestionsForEverything." | 150 "PaymentRequest.UserDidNotHaveSuggestionsForEverything." |
| 146 "EffectOnCompletion", | 151 "EffectOnCompletion", |
| 147 completion_status, COMPLETION_STATUS_MAX); | 152 completion_status, COMPLETION_STATUS_MAX); |
| 148 } | 153 } |
| 149 } | 154 } |
| 150 | 155 |
| 151 void JourneyLogger::RecordCanMakePaymentStats( | 156 void JourneyLogger::RecordCanMakePaymentStats( |
| 152 CompletionStatus completion_status) { | 157 CompletionStatus completion_status) { |
| 158 // CanMakePayment always returns true in incognito mode. Don't log the | |
| 159 // metrics. | |
|
Mathieu
2017/04/03 20:19:30
*metric
sebsg
2017/04/03 21:04:26
There are more than one :)
| |
| 160 if (is_incognito_) | |
| 161 return; | |
| 162 | |
| 153 // Record CanMakePayment usage. | 163 // Record CanMakePayment usage. |
| 154 UMA_HISTOGRAM_ENUMERATION("PaymentRequest.CanMakePayment.Usage", | 164 UMA_HISTOGRAM_ENUMERATION("PaymentRequest.CanMakePayment.Usage", |
| 155 was_can_make_payments_used_ | 165 was_can_make_payments_used_ |
| 156 ? CAN_MAKE_PAYMENT_USED | 166 ? CAN_MAKE_PAYMENT_USED |
| 157 : CAN_MAKE_PAYMENT_NOT_USED, | 167 : CAN_MAKE_PAYMENT_NOT_USED, |
| 158 CAN_MAKE_PAYMENT_USE_MAX); | 168 CAN_MAKE_PAYMENT_USE_MAX); |
| 159 | 169 |
| 160 RecordCanMakePaymentEffectOnShow(); | 170 RecordCanMakePaymentEffectOnShow(); |
| 161 RecordCanMakePaymentEffectOnCompletion(completion_status); | 171 RecordCanMakePaymentEffectOnCompletion(completion_status); |
| 162 } | 172 } |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 187 histogram_name += "Used.TrueWithShowEffectOnCompletion"; | 197 histogram_name += "Used.TrueWithShowEffectOnCompletion"; |
| 188 } else { | 198 } else { |
| 189 histogram_name += "Used.FalseWithShowEffectOnCompletion"; | 199 histogram_name += "Used.FalseWithShowEffectOnCompletion"; |
| 190 } | 200 } |
| 191 | 201 |
| 192 base::UmaHistogramEnumeration(histogram_name, completion_status, | 202 base::UmaHistogramEnumeration(histogram_name, completion_status, |
| 193 COMPLETION_STATUS_MAX); | 203 COMPLETION_STATUS_MAX); |
| 194 } | 204 } |
| 195 | 205 |
| 196 } // namespace payments | 206 } // namespace payments |
| OLD | NEW |