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

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

Issue 2199813003: [Payments] Add metrics for Payment Request aborts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metrics
Patch Set: Moved metrics enum to PaymentRequestMetrics.java Created 4 years, 4 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 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.VisibleForTesting; 7 import org.chromium.base.VisibleForTesting;
8 import org.chromium.base.metrics.RecordHistogram; 8 import org.chromium.base.metrics.RecordHistogram;
9 9
10 /** 10 /**
11 * A class used to record metrics for the Payment Request feature. 11 * A class used to record metrics for the Payment Request feature.
12 */ 12 */
13 public final class PaymentRequestMetrics { 13 public final class PaymentRequestMetrics {
14 14
15 // PaymentRequestRequestedInformation defined in tools/metrics/histograms/hi stograms.xml. 15 // PaymentRequestRequestedInformation defined in tools/metrics/histograms/hi stograms.xml.
16 @VisibleForTesting 16 @VisibleForTesting
17 public static final int REQUESTED_INFORMATION_NONE = 0; 17 public static final int REQUESTED_INFORMATION_NONE = 0;
18 @VisibleForTesting 18 @VisibleForTesting
19 public static final int REQUESTED_INFORMATION_EMAIL = 1 << 0; 19 public static final int REQUESTED_INFORMATION_EMAIL = 1 << 0;
20 @VisibleForTesting 20 @VisibleForTesting
21 public static final int REQUESTED_INFORMATION_PHONE = 1 << 1; 21 public static final int REQUESTED_INFORMATION_PHONE = 1 << 1;
22 @VisibleForTesting 22 @VisibleForTesting
23 public static final int REQUESTED_INFORMATION_SHIPPING = 1 << 2; 23 public static final int REQUESTED_INFORMATION_SHIPPING = 1 << 2;
24 @VisibleForTesting 24 @VisibleForTesting
25 public static final int REQUESTED_INFORMATION_MAX = 8; 25 public static final int REQUESTED_INFORMATION_MAX = 8;
26 26
27 // PaymentRequestAbortReason defined in tools/metrics/histograms/histograms. xml.
28 @VisibleForTesting
29 public static final int ABORT_REASON_ABORTED_BY_USER = 0;
30 @VisibleForTesting
31 public static final int ABORT_REASON_ABORTED_BY_MERCHANT = 1;
32 @VisibleForTesting
33 public static final int ABORT_REASON_INVALID_DATA_FROM_RENDERER = 2;
34 @VisibleForTesting
35 public static final int ABORT_REASON_MOJO_CONNECTION_ERROR = 3;
36 @VisibleForTesting
37 public static final int ABORT_REASON_MOJO_RENDERER_CLOSING = 4;
38 @VisibleForTesting
39 public static final int ABORT_REASON_INSTRUMENT_DETAILS_ERROR = 5;
40 @VisibleForTesting
41 public static final int ABORT_REASON_NO_MATCHING_PAYMENT_METHOD = 6;
42 @VisibleForTesting
43 public static final int ABORT_REASON_NO_SUPPORTED_PAYMENT_METHOD = 7;
44 @VisibleForTesting
45 public static final int ABORT_REASON_OTHER = 8;
46 @VisibleForTesting
47 public static final int ABORT_REASON_MAX = 9;
48
27 // There should be no instance of PaymentRequestMetrics created. 49 // There should be no instance of PaymentRequestMetrics created.
28 private PaymentRequestMetrics() {} 50 private PaymentRequestMetrics() {}
29 51
30 /* 52 /*
31 * Records the metric that keeps track of what user information are requeste d by merchants to 53 * Records the metric that keeps track of what user information are requeste d by merchants to
32 * complete a payment request. 54 * complete a payment request.
33 * 55 *
34 * @param requestEmail Whether the merchant requested an email address. 56 * @param requestEmail Whether the merchant requested an email address.
35 * @param requestPhone Whether the merchant requested a phone number. 57 * @param requestPhone Whether the merchant requested a phone number.
36 * @param requestShipping Whether the merchant requested a shipping address. 58 * @param requestShipping Whether the merchant requested a shipping address.
37 */ 59 */
38 public static void recordRequestedInformationHistogram(boolean requestEmail, 60 public static void recordRequestedInformationHistogram(boolean requestEmail,
39 boolean requestPhone, boolean requestShipping) { 61 boolean requestPhone, boolean requestShipping) {
40 int requestInformation = 62 int requestInformation =
41 (requestEmail ? REQUESTED_INFORMATION_EMAIL : 0) 63 (requestEmail ? REQUESTED_INFORMATION_EMAIL : 0)
42 | (requestPhone ? REQUESTED_INFORMATION_PHONE : 0) 64 | (requestPhone ? REQUESTED_INFORMATION_PHONE : 0)
43 | (requestShipping ? REQUESTED_INFORMATION_SHIPPING : 0); 65 | (requestShipping ? REQUESTED_INFORMATION_SHIPPING : 0);
44 RecordHistogram.recordEnumeratedHistogram("PaymentRequest.RequestedInfor mation", 66 RecordHistogram.recordEnumeratedHistogram("PaymentRequest.RequestedInfor mation",
45 requestInformation, REQUESTED_INFORMATION_MAX); 67 requestInformation, REQUESTED_INFORMATION_MAX);
46 } 68 }
47 } 69 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698