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

Unified Diff: components/payments/core/journey_logger.h

Issue 2808513002: [Payments] Add PaymentRequest checkout funnel UKMs. (Closed)
Patch Set: Addressed Mathp's comments Created 3 years, 8 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: components/payments/core/journey_logger.h
diff --git a/components/payments/core/journey_logger.h b/components/payments/core/journey_logger.h
index 67401c1ec4af961ca11b371d1d135fe6f5655730..9364d962ccd36dc53687d7077f8cc2d5d46cc12a 100644
--- a/components/payments/core/journey_logger.h
+++ b/components/payments/core/journey_logger.h
@@ -8,6 +8,18 @@
#include <string>
#include "base/macros.h"
+#include "url/gurl.h"
+
+namespace ukm {
+class UkmService;
+}
+
+namespace internal {
+// Name constants are exposed here so they can be referenced from tests.
+extern const char kUKMCheckoutFunnelEntryName[];
+extern const char kUKMCompletionStatusMetricName[];
+extern const char kUKMLastStepMetricName[];
+} // namespace internal
namespace payments {
@@ -46,6 +58,14 @@ class JourneyLogger {
COMPLETION_STATUS_MAX,
};
+ // Used to record the different events that happened during the Payment
+ // Request.
+ static const int EVENT_NOT_SHOWN = 0;
Mathieu 2017/04/10 15:56:18 I liked the enum!
sebsg 2017/04/10 17:27:56 Done.
+ static const int EVENT_SHOWN = 1 << 0;
Mathieu 2017/04/10 15:56:18 same comment about alignment: https://cs.chromium.
sebsg 2017/04/10 17:27:56 Same as above.
+ static const int EVENT_PAY_CLICKED = 1 << 1;
+ static const int EVENT_RECEIVED_INSTRUMENT_DETAILS = 1 << 2;
+ static const int EVENT_MAX = 8;
+
// Used to mesure the impact of the CanMakePayment return value on whether the
// Payment Request is shown to the user.
static const int CMP_SHOW_COULD_NOT_MAKE_PAYMENT_AND_DID_NOT_SHOW = 0;
@@ -53,7 +73,7 @@ class JourneyLogger {
static const int CMP_SHOW_COULD_MAKE_PAYMENT = 1 << 1;
static const int CMP_SHOW_MAX = 4;
- explicit JourneyLogger(bool is_incognito);
+ JourneyLogger(bool is_incognito, GURL url, ukm::UkmService* ukm_service);
~JourneyLogger();
// Increments the number of selection adds for the specified section.
@@ -75,6 +95,9 @@ class JourneyLogger {
// Records the fact that the Payment Request was shown to the user.
void SetShowCalled();
+ // Records that an event occured.
+ void SetEventOccured(int event);
+
// Records the histograms for all the sections that were requested by the
// merchant and for the usage of the CanMakePayment method and its effect on
// the transaction. This method should be called when the Payment Request has
@@ -125,12 +148,20 @@ class JourneyLogger {
void RecordCanMakePaymentEffectOnCompletion(
CompletionStatus completion_status);
+ // Records the Payment Request Url Keyed Metrics.
+ void RecordUrlKeyedMetrics(CompletionStatus completion_status);
+
SectionStats sections_[NUMBER_OF_SECTIONS];
bool was_can_make_payments_used_;
bool could_make_payment_;
bool was_show_called_;
bool is_incognito_;
+ int events_;
Mathieu 2017/04/10 15:56:18 Add a comment talking about what it's doing and wh
sebsg 2017/04/10 17:27:56 Done.
+
+ GURL url_;
+ ukm::UkmService* ukm_service_;
+
DISALLOW_COPY_AND_ASSIGN(JourneyLogger);
};

Powered by Google App Engine
This is Rietveld 408576698