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

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

Issue 2808513002: [Payments] Add PaymentRequest checkout funnel UKMs. (Closed)
Patch Set: Addressed 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..99bf3720a1d62e76a1af5884bc7ce716d9d62971 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 {
please use gerrit instead 2017/04/10 19:20:03 Put this inside of payments namespace please.
sebsg 2017/04/10 19:49:53 Done.
+// 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,16 @@ class JourneyLogger {
COMPLETION_STATUS_MAX,
};
+ // Used to record the different events that happened during the Payment
+ // Request.
+ enum Event {
+ EVENT_INITIATED = 0,
+ EVENT_SHOWN = 1 << 0,
+ EVENT_PAY_CLICKED = 1 << 1,
+ EVENT_RECEIVED_INSTRUMENT_DETAILS = 1 << 2,
+ 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 +75,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);
please use gerrit instead 2017/04/10 19:20:03 url should be const-ref.
please use gerrit instead 2017/04/10 19:20:03 Add a comment about life time expectations for ukm
sebsg 2017/04/10 19:49:52 Added the comment on the stored pointer, seems lik
sebsg 2017/04/10 19:49:52 Done.
~JourneyLogger();
// Increments the number of selection adds for the specified section.
@@ -75,6 +97,9 @@ class JourneyLogger {
// Records the fact that the Payment Request was shown to the user.
void SetShowCalled();
+ // Records that an event occurred.
+ void SetEventOccurred(Event 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 +150,21 @@ 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_;
+ // Accumulates the many event that have happened during the Payment Request.
Mathieu 2017/04/10 19:03:15 *events
sebsg 2017/04/10 19:49:52 Done.
+ int events_;
+
+ GURL url_;
+ ukm::UkmService* ukm_service_;
+
DISALLOW_COPY_AND_ASSIGN(JourneyLogger);
};

Powered by Google App Engine
This is Rietveld 408576698