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

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

Issue 2642213005: [Payments] Add CanMakePayment metrics. (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLogger.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLogger.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLogger.java
index 999189858396d0e45268e8b9eaf38ba0f1418fb7..94cc0b4d07c31e0e7834a36275564da7ed5d59e8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLogger.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestJourneyLogger.java
@@ -10,11 +10,27 @@ import org.chromium.base.metrics.RecordHistogram;
* A class used to record journey metrics for the Payment Request feature.
*/
public class PaymentRequestJourneyLogger {
+ // The index of the different sections of a Payment Request. Used to record journey stats.
public static final int SECTION_CONTACT_INFO = 0;
public static final int SECTION_CREDIT_CARDS = 1;
public static final int SECTION_SHIPPING_ADDRESS = 2;
public static final int SECTION_MAX = 3;
+ // For the CanMakePayment histograms.
+ public static final int CAN_MAKE_PAYMENT_USED = 0;
+ public static final int CAN_MAKE_PAYMENT_NOT_USED = 1;
+ public static final int CAN_MAKE_PAYMENT_USE_MAX = 2;
+
+ public static final int EFFECT_ON_COMPLETION_COMPLETED = 0;
+ public static final int EFFECT_ON_COMPLETION_ABORTED = 1;
+ public static final int EFFECT_ON_COMPLETION_MAX = 2;
+
+ public static final int EFFECT_ON_SHOW_FALSE_NOT_SHOWN = 0;
+ public static final int EFFECT_ON_SHOW_FALSE_SHOWN = 1;
+ public static final int EFFECT_ON_SHOW_TRUE_NOT_SHOWN = 2;
+ public static final int EFFECT_ON_SHOW_TRUE_SHOWN = 3;
+ public static final int EFFECT_ON_SHOW_MAX = 4;
+
// The minimum expected value of CustomCountHistograms is always set to 1. It is still possible
// to log the value 0 to that type of histogram.
private static final int MIN_EXPECTED_SAMPLE = 1;
@@ -31,6 +47,10 @@ public class PaymentRequestJourneyLogger {
private SectionStats[] mSections;
+ private boolean mWasCanMakePaymentUsed;
+ private boolean mCouldMakePayment;
+ private boolean mWasShowCalled;
+
public PaymentRequestJourneyLogger() {
mSections = new SectionStats[SECTION_MAX];
for (int i = 0; i < mSections.length; ++i) {
@@ -38,7 +58,7 @@ public class PaymentRequestJourneyLogger {
}
}
- /*
+ /**
* Sets the number of suggestions shown for the specified section.
*
* @param section The section for which to log.
@@ -50,7 +70,7 @@ public class PaymentRequestJourneyLogger {
mSections[section].mIsRequested = true;
}
- /*
+ /**
* Increments the number of selection changes for the specified section.
*
* @param section The section for which to log.
@@ -60,7 +80,7 @@ public class PaymentRequestJourneyLogger {
mSections[section].mNumberSelectionChanges++;
}
- /*
+ /**
* Increments the number of selection edits for the specified section.
*
* @param section The section for which to log.
@@ -70,7 +90,7 @@ public class PaymentRequestJourneyLogger {
mSections[section].mNumberSelectionEdits++;
}
- /*
+ /**
* Increments the number of selection adds for the specified section.
*
* @param section The section for which to log.
@@ -80,6 +100,23 @@ public class PaymentRequestJourneyLogger {
mSections[section].mNumberSelectionAdds++;
}
+ /**
+ * Records the fact that the merchant called CanMakePayment and records it's return value.
+ *
+ * @param value The return value of the CanMakePayment call.
+ */
+ public void setCanMakePaymentValue(boolean value) {
+ mWasCanMakePaymentUsed = true;
+ mCouldMakePayment |= value;
+ }
+
+ /**
+ * Records the fact that the Payment Request was shown to the user.
+ */
+ public void setShowCalled() {
+ mWasShowCalled = true;
+ }
+
/*
* Records the histograms for all the sections that were requested by the merchant. This method
* should be called when the payment request has either been completed or aborted.
@@ -87,6 +124,7 @@ public class PaymentRequestJourneyLogger {
* @param submissionType A string indicating the way the payment request was concluded.
*/
public void recordJourneyStatsHistograms(String submissionType) {
+ // Sections stats.
for (int i = 0; i < mSections.length; ++i) {
String nameSuffix = "";
switch (i) {
@@ -125,5 +163,43 @@ public class PaymentRequestJourneyLogger {
MIN_EXPECTED_SAMPLE, MAX_EXPECTED_SAMPLE, NUMBER_BUCKETS);
}
}
+
+ // Record CanMakePayment stats.
+ int submissionTypeSample = submissionType.contains("Abort")
+ ? EFFECT_ON_COMPLETION_ABORTED
please use gerrit instead 2017/01/23 21:04:32 This can easily be confused with PaymentRequest.ab
sebsg 2017/01/23 22:57:23 Done.
+ : EFFECT_ON_COMPLETION_COMPLETED;
+ if (mWasCanMakePaymentUsed) {
+ RecordHistogram.recordEnumeratedHistogram("PaymentRequest.CanMakePayment.Usage",
+ CAN_MAKE_PAYMENT_USED, CAN_MAKE_PAYMENT_USE_MAX);
+
+ // Record effect on show.
+ int sample = 0;
please use gerrit instead 2017/01/23 21:04:32 s/sample/effectOnPayment/g
sebsg 2017/01/23 22:57:23 Done.
+ if (mWasShowCalled) sample += 1;
+ if (mCouldMakePayment) sample += 2;
please use gerrit instead 2017/01/23 21:04:32 Boy, this makes my head hurt. Can this be simplifi
sebsg 2017/01/23 22:57:23 Done.
+ RecordHistogram.recordEnumeratedHistogram(
+ "PaymentRequest.CanMakePayment.Used.EffetOnShow", sample, 4);
+
+ // Record the completion stats depending on CanMakePayment value.
+ if (mCouldMakePayment && mWasShowCalled) {
+ RecordHistogram.recordEnumeratedHistogram(
+ "PaymentRequest.CanMakePayment.Used.TrueWithShowEffectOnCompletion",
+ submissionTypeSample, EFFECT_ON_COMPLETION_MAX);
+ } else if (!mCouldMakePayment && mWasShowCalled) {
+ RecordHistogram.recordEnumeratedHistogram(
+ "PaymentRequest.CanMakePayment.Used.FalseWithShowEffectOnCompletion",
+ submissionTypeSample, EFFECT_ON_COMPLETION_MAX);
+ }
+
+ } else {
+ RecordHistogram.recordEnumeratedHistogram("PaymentRequest.CanMakePayment.Usage",
+ CAN_MAKE_PAYMENT_NOT_USED, CAN_MAKE_PAYMENT_USE_MAX);
+
+ // Record completion stats when CanMakePayment is not used.
+ if (mWasShowCalled) {
+ RecordHistogram.recordEnumeratedHistogram(
+ "PaymentRequest.CanMakePayment.NotUsed.WithShowEffectOnCompletion",
+ submissionTypeSample, EFFECT_ON_COMPLETION_MAX);
+ }
+ }
please use gerrit instead 2017/01/23 21:04:33 I cannot, however, vouch for the validity of the l
sebsg 2017/01/23 22:57:23 Done.
}
}

Powered by Google App Engine
This is Rietveld 408576698