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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLogger.java

Issue 2691083005: [Merge-57] Add completion metrics based on user had suggestions for all. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentMetricsTest.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 package org.chromium.chrome.browser.payments; 5 package org.chromium.chrome.browser.payments;
6 6
7 import org.chromium.base.metrics.RecordHistogram; 7 import org.chromium.base.metrics.RecordHistogram;
8 8
9 /** 9 /**
10 * A class used to record journey metrics for the Payment Request feature. 10 * A class used to record journey metrics for the Payment Request feature.
11 */ 11 */
12 public class PaymentRequestJourneyLogger { 12 public class PaymentRequestJourneyLogger {
13 // The index of the different sections of a Payment Request. Used to record journey stats. 13 // The index of the different sections of a Payment Request. Used to record journey stats.
14 public static final int SECTION_CONTACT_INFO = 0; 14 public static final int SECTION_CONTACT_INFO = 0;
15 public static final int SECTION_CREDIT_CARDS = 1; 15 public static final int SECTION_CREDIT_CARDS = 1;
16 public static final int SECTION_SHIPPING_ADDRESS = 2; 16 public static final int SECTION_SHIPPING_ADDRESS = 2;
17 public static final int SECTION_MAX = 3; 17 public static final int SECTION_MAX = 3;
18 18
19 // For the CanMakePayment histograms. 19 // For the CanMakePayment histograms.
20 public static final int CAN_MAKE_PAYMENT_USED = 0; 20 public static final int CAN_MAKE_PAYMENT_USED = 0;
21 public static final int CAN_MAKE_PAYMENT_NOT_USED = 1; 21 public static final int CAN_MAKE_PAYMENT_NOT_USED = 1;
22 public static final int CAN_MAKE_PAYMENT_USE_MAX = 2; 22 public static final int CAN_MAKE_PAYMENT_USE_MAX = 2;
23 23
24 // Used to log CanMakePayment's effect on whether the transaction was comple ted. 24 // Used to log different parameters' effect on whether the transaction was c ompleted.
25 public static final int CMP_EFFECT_ON_COMPLETION_COMPLETED = 0; 25 public static final int COMPLETION_STATUS_COMPLETED = 0;
26 public static final int CMP_EFFECT_ON_COMPLETION_ABORTED = 1; 26 public static final int COMPLETION_STATUS_ABORTED = 1;
27 public static final int CMP_EFFECT_ON_COMPLETION_MAX = 2; 27 public static final int COMPLETION_STATUS_MAX = 2;
28 28
29 // Used to mesure the impact of the CanMakePayment return value on whether t he Payment Request 29 // Used to mesure the impact of the CanMakePayment return value on whether t he Payment Request
30 // is shown to the user. 30 // is shown to the user.
31 public static final int CMP_SHOW_COULD_NOT_MAKE_PAYMENT_AND_DID_NOT_SHOW = 0 ; 31 public static final int CMP_SHOW_COULD_NOT_MAKE_PAYMENT_AND_DID_NOT_SHOW = 0 ;
32 public static final int CMP_SHOW_DID_SHOW = 1 << 0; 32 public static final int CMP_SHOW_DID_SHOW = 1 << 0;
33 public static final int CMP_SHOW_COULD_MAKE_PAYMENT = 1 << 1; 33 public static final int CMP_SHOW_COULD_MAKE_PAYMENT = 1 << 1;
34 public static final int CMP_SHOW_MAX = 4; 34 public static final int CMP_SHOW_MAX = 4;
35 35
36 // The minimum expected value of CustomCountHistograms is always set to 1. I t is still possible 36 // The minimum expected value of CustomCountHistograms is always set to 1. I t is still possible
37 // to log the value 0 to that type of histogram. 37 // to log the value 0 to that type of histogram.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 * usage of the CanMakePayment method and its effect on the transaction. Thi s method should be 124 * usage of the CanMakePayment method and its effect on the transaction. Thi s method should be
125 * called when the payment request has either been completed or aborted. 125 * called when the payment request has either been completed or aborted.
126 * 126 *
127 * @param submissionType A string indicating the way the payment request was concluded. 127 * @param submissionType A string indicating the way the payment request was concluded.
128 */ 128 */
129 public void recordJourneyStatsHistograms(String submissionType) { 129 public void recordJourneyStatsHistograms(String submissionType) {
130 recordSectionSpecificStats(submissionType); 130 recordSectionSpecificStats(submissionType);
131 131
132 // Record the CanMakePayment metrics based on whether the transaction wa s completed or 132 // Record the CanMakePayment metrics based on whether the transaction wa s completed or
133 // aborted by the user (UserAborted) or otherwise (OtherAborted). 133 // aborted by the user (UserAborted) or otherwise (OtherAborted).
134 recordCanMakePaymentStats(submissionType.contains("Abort") 134 recordCanMakePaymentStats(submissionType.contains("Abort") ? COMPLETION_ STATUS_ABORTED
135 ? CMP_EFFECT_ON_COMPLETION_ABORTED 135 : COMPLETION_ STATUS_COMPLETED);
136 : CMP_EFFECT_ON_COMPLETION_COMPLETED);
137 } 136 }
138 137
139 /** 138 /**
140 * Records the histograms for all the sections that were requested by the me rchant. 139 * Records the histograms for all the sections that were requested by the me rchant.
141 * 140 *
142 * @param submissionType A string indicating the way the payment request was concluded. 141 * @param submissionType A string indicating the way the payment request was concluded.
143 */ 142 */
144 private void recordSectionSpecificStats(String submissionType) { 143 private void recordSectionSpecificStats(String submissionType) {
144 // Record whether the user had suggestions for each requested informatio n.
145 boolean userHadAllRequestedInformation = true;
146
145 for (int i = 0; i < mSections.length; ++i) { 147 for (int i = 0; i < mSections.length; ++i) {
146 String nameSuffix = ""; 148 String nameSuffix = "";
147 switch (i) { 149 switch (i) {
148 case SECTION_SHIPPING_ADDRESS: 150 case SECTION_SHIPPING_ADDRESS:
149 nameSuffix = "ShippingAddress." + submissionType; 151 nameSuffix = "ShippingAddress." + submissionType;
150 break; 152 break;
151 case SECTION_CONTACT_INFO: 153 case SECTION_CONTACT_INFO:
152 nameSuffix = "ContactInfo." + submissionType; 154 nameSuffix = "ContactInfo." + submissionType;
153 break; 155 break;
154 case SECTION_CREDIT_CARDS: 156 case SECTION_CREDIT_CARDS:
(...skipping 16 matching lines...) Expand all
171 Math.min(mSections[i].mNumberSelectionChanges, MAX_EXPEC TED_SAMPLE), 173 Math.min(mSections[i].mNumberSelectionChanges, MAX_EXPEC TED_SAMPLE),
172 MIN_EXPECTED_SAMPLE, MAX_EXPECTED_SAMPLE, NUMBER_BUCKETS ); 174 MIN_EXPECTED_SAMPLE, MAX_EXPECTED_SAMPLE, NUMBER_BUCKETS );
173 RecordHistogram.recordCustomCountHistogram( 175 RecordHistogram.recordCustomCountHistogram(
174 "PaymentRequest.NumberOfSelectionEdits." + nameSuffix, 176 "PaymentRequest.NumberOfSelectionEdits." + nameSuffix,
175 Math.min(mSections[i].mNumberSelectionEdits, MAX_EXPECTE D_SAMPLE), 177 Math.min(mSections[i].mNumberSelectionEdits, MAX_EXPECTE D_SAMPLE),
176 MIN_EXPECTED_SAMPLE, MAX_EXPECTED_SAMPLE, NUMBER_BUCKETS ); 178 MIN_EXPECTED_SAMPLE, MAX_EXPECTED_SAMPLE, NUMBER_BUCKETS );
177 RecordHistogram.recordCustomCountHistogram( 179 RecordHistogram.recordCustomCountHistogram(
178 "PaymentRequest.NumberOfSuggestionsShown." + nameSuffix, 180 "PaymentRequest.NumberOfSuggestionsShown." + nameSuffix,
179 Math.min(mSections[i].mNumberSuggestionsShown, MAX_EXPEC TED_SAMPLE), 181 Math.min(mSections[i].mNumberSuggestionsShown, MAX_EXPEC TED_SAMPLE),
180 MIN_EXPECTED_SAMPLE, MAX_EXPECTED_SAMPLE, NUMBER_BUCKETS ); 182 MIN_EXPECTED_SAMPLE, MAX_EXPECTED_SAMPLE, NUMBER_BUCKETS );
183
184 if (mSections[i].mNumberSuggestionsShown == 0) {
185 userHadAllRequestedInformation = false;
186 }
181 } 187 }
182 } 188 }
189
190 // Record metrics about completion based on whether the user had suggest ions for each
191 // requested information.
192 int completionStatus = submissionType.contains("Abort") ? COMPLETION_STA TUS_ABORTED
193 : COMPLETION_STA TUS_COMPLETED;
194 if (userHadAllRequestedInformation) {
195 RecordHistogram.recordEnumeratedHistogram(
196 "PaymentRequest.UserHadSuggestionsForEverything.EffectOnComp letion",
197 completionStatus, COMPLETION_STATUS_MAX);
198 } else {
199 RecordHistogram.recordEnumeratedHistogram(
200 "PaymentRequest.UserDidNotHaveSuggestionsForEverything.Effec tOnCompletion",
201 completionStatus, COMPLETION_STATUS_MAX);
202 }
183 } 203 }
184 204
185 /** 205 /**
186 * Records the metrics related the the CanMakePayment method. 206 * Records the metrics related the the CanMakePayment method.
187 * 207 *
188 * @param completionStatus Whether the transaction was completed or aborted. 208 * @param completionStatus Whether the transaction was completed or aborted.
189 */ 209 */
190 private void recordCanMakePaymentStats(int completionStatus) { 210 private void recordCanMakePaymentStats(int completionStatus) {
191 // Record CanMakePayment usage. 211 // Record CanMakePayment usage.
192 RecordHistogram.recordEnumeratedHistogram("PaymentRequest.CanMakePayment .Usage", 212 RecordHistogram.recordEnumeratedHistogram("PaymentRequest.CanMakePayment .Usage",
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 244
225 if (!mWasCanMakePaymentUsed) { 245 if (!mWasCanMakePaymentUsed) {
226 histogramName += "NotUsed.WithShowEffectOnCompletion"; 246 histogramName += "NotUsed.WithShowEffectOnCompletion";
227 } else if (mCouldMakePayment) { 247 } else if (mCouldMakePayment) {
228 histogramName += "Used.TrueWithShowEffectOnCompletion"; 248 histogramName += "Used.TrueWithShowEffectOnCompletion";
229 } else { 249 } else {
230 histogramName += "Used.FalseWithShowEffectOnCompletion"; 250 histogramName += "Used.FalseWithShowEffectOnCompletion";
231 } 251 }
232 252
233 RecordHistogram.recordEnumeratedHistogram( 253 RecordHistogram.recordEnumeratedHistogram(
234 histogramName, completionStatus, CMP_EFFECT_ON_COMPLETION_MAX); 254 histogramName, completionStatus, COMPLETION_STATUS_MAX);
235 } 255 }
236 } 256 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestCanMakePaymentMetricsTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698