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

Unified Diff: chrome/browser/engagement/site_engagement_metrics.h

Issue 1368533004: Add UMA metrics to the site engagement service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@time-on-site
Patch Set: Refactor tests Created 5 years, 2 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/browser/engagement/site_engagement_metrics.h
diff --git a/chrome/browser/engagement/site_engagement_metrics.h b/chrome/browser/engagement/site_engagement_metrics.h
new file mode 100644
index 0000000000000000000000000000000000000000..d07cdaa2de32ec63fcaafe4b3a8f4242d4ad905d
--- /dev/null
+++ b/chrome/browser/engagement/site_engagement_metrics.h
@@ -0,0 +1,51 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_METRICS_H_
+#define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_METRICS_H_
+
+#include <map>
+
+#include "base/gtest_prod_util.h"
+#include "url/gurl.h"
+
+// Helper class managing the UMA histograms for the Site Engagement Service.
+class SiteEngagementMetrics {
+ public:
+ // This is used to back a UMA histogram, so it should be treated as
+ // append-only. Any new values should be inserted immediately prior to
+ // ENGAGEMENT_LAST.
+ enum EngagementType {
+ ENGAGEMENT_NAVIGATION,
+ ENGAGEMENT_KEYPRESS,
+ ENGAGEMENT_MOUSE,
+ ENGAGEMENT_LAST,
+ };
+
+ static void RecordTotalSiteEngagement(double total_engagement);
+ static void RecordTotalOriginsEngaged(int total_origins);
+ static void RecordMeanEngagement(double mean_engagement);
+ static void RecordMedianEngagement(double median_engagement);
+ static void RecordEngagementScores(std::map<GURL, double> score_map);
+ static void RecordOriginsWithMaxEngagement(int total_origins);
+ static void RecordOriginsWithMaxDailyEngagement(int total_origins);
+ static void RecordPercentOriginsWithMaxEngagement(double percentage);
+ static void RecordEngagement(EngagementType type);
+
+ private:
+ FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, CheckHistograms);
+ FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceBrowserTest,
+ MixedInputEngagementAccumulation);
+ static const char kTotalEngagementHistogram[];
+ static const char kTotalOriginsHistogram[];
+ static const char kMeanEngagementHistogram[];
+ static const char kMedianEngagementHistogram[];
+ static const char kEngagementScoreHistogram[];
+ static const char kOriginsWithMaxEngagementHistogram[];
+ static const char kOriginsWithMaxDailyEngagementHistogram[];
+ static const char kPercentOriginsWithMaxEngagementHistogram[];
+ static const char kEngagementTypeHistogram[];
+};
+
+#endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_METRICS_H_
« no previous file with comments | « chrome/browser/engagement/site_engagement_helper.cc ('k') | chrome/browser/engagement/site_engagement_metrics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698