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

Side by Side Diff: chrome/browser/engagement/site_engagement_metrics.h

Issue 2748103011: Grant origins engagement for having interactions on their notifications. (Closed)
Patch Set: Unfriend Created 3 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_METRICS_H_ 5 #ifndef CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_METRICS_H_
6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_METRICS_H_ 6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_METRICS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "url/gurl.h" 12 #include "url/gurl.h"
13 13
14 // Helper class managing the UMA histograms for the Site Engagement Service. 14 // Helper class managing the UMA histograms for the Site Engagement Service.
15 class SiteEngagementMetrics { 15 class SiteEngagementMetrics {
16 public: 16 public:
17 // This is used to back a UMA histogram, so it should be treated as 17 // This is used to back a UMA histogram, so it should be treated as
18 // append-only. Any new values should be inserted immediately prior to 18 // append-only. Any new values should be inserted immediately prior to
19 // ENGAGEMENT_LAST. 19 // ENGAGEMENT_LAST.
20 enum EngagementType { 20 enum EngagementType {
21 ENGAGEMENT_NAVIGATION, 21 ENGAGEMENT_NAVIGATION,
22 ENGAGEMENT_KEYPRESS, 22 ENGAGEMENT_KEYPRESS,
23 ENGAGEMENT_MOUSE, 23 ENGAGEMENT_MOUSE,
24 ENGAGEMENT_TOUCH_GESTURE, 24 ENGAGEMENT_TOUCH_GESTURE,
25 ENGAGEMENT_SCROLL, 25 ENGAGEMENT_SCROLL,
26 ENGAGEMENT_MEDIA_HIDDEN, 26 ENGAGEMENT_MEDIA_HIDDEN,
27 ENGAGEMENT_MEDIA_VISIBLE, 27 ENGAGEMENT_MEDIA_VISIBLE,
28 ENGAGEMENT_WEBAPP_SHORTCUT_LAUNCH, 28 ENGAGEMENT_WEBAPP_SHORTCUT_LAUNCH,
29 ENGAGEMENT_FIRST_DAILY_ENGAGEMENT, 29 ENGAGEMENT_FIRST_DAILY_ENGAGEMENT,
30 ENGAGEMENT_NOTIFICATION_INTERACTION,
30 ENGAGEMENT_LAST, 31 ENGAGEMENT_LAST,
31 }; 32 };
32 33
33 static void RecordTotalSiteEngagement(double total_engagement); 34 static void RecordTotalSiteEngagement(double total_engagement);
34 static void RecordTotalOriginsEngaged(int total_origins); 35 static void RecordTotalOriginsEngaged(int total_origins);
35 static void RecordMeanEngagement(double mean_engagement); 36 static void RecordMeanEngagement(double mean_engagement);
36 static void RecordMedianEngagement(double median_engagement); 37 static void RecordMedianEngagement(double median_engagement);
37 static void RecordEngagementPercentageForHTTPS(double percentage); 38 static void RecordEngagementPercentageForHTTPS(double percentage);
38 static void RecordEngagementScores(const std::map<GURL, double>& score_map); 39 static void RecordEngagementScores(const std::map<GURL, double>& score_map);
39 static void RecordOriginsWithMaxEngagement(int total_origins); 40 static void RecordOriginsWithMaxEngagement(int total_origins);
40 static void RecordOriginsWithMaxDailyEngagement(int total_origins); 41 static void RecordOriginsWithMaxDailyEngagement(int total_origins);
41 static void RecordPercentOriginsWithMaxEngagement(double percentage); 42 static void RecordPercentOriginsWithMaxEngagement(double percentage);
42 static void RecordEngagement(EngagementType type); 43 static void RecordEngagement(EngagementType type);
43 static void RecordDaysSinceLastShortcutLaunch(int days); 44 static void RecordDaysSinceLastShortcutLaunch(int days);
44 static void RecordScoreDecayedFrom(double score); 45 static void RecordScoreDecayedFrom(double score);
45 static void RecordScoreDecayedTo(double score); 46 static void RecordScoreDecayedTo(double score);
46 47
47 private: 48 private:
48 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, CheckHistograms); 49 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, CheckHistograms);
50 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest,
51 GetTotalNotificationPoints);
49 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, LastShortcutLaunch); 52 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, LastShortcutLaunch);
50 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, ScoreDecayHistograms); 53 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, ScoreDecayHistograms);
51 FRIEND_TEST_ALL_PREFIXES(SiteEngagementHelperTest, 54 FRIEND_TEST_ALL_PREFIXES(SiteEngagementHelperTest,
52 MixedInputEngagementAccumulation); 55 MixedInputEngagementAccumulation);
53 static const char kTotalEngagementHistogram[]; 56 static const char kTotalEngagementHistogram[];
54 static const char kTotalOriginsHistogram[]; 57 static const char kTotalOriginsHistogram[];
55 static const char kMeanEngagementHistogram[]; 58 static const char kMeanEngagementHistogram[];
56 static const char kMedianEngagementHistogram[]; 59 static const char kMedianEngagementHistogram[];
57 static const char kEngagementPercentageForHTTPSHistogram[]; 60 static const char kEngagementPercentageForHTTPSHistogram[];
58 static const char kEngagementScoreHistogram[]; 61 static const char kEngagementScoreHistogram[];
59 static const char kEngagementScoreHistogramHTTP[]; 62 static const char kEngagementScoreHistogramHTTP[];
60 static const char kEngagementScoreHistogramHTTPS[]; 63 static const char kEngagementScoreHistogramHTTPS[];
61 static const char kEngagementScoreHistogramIsZero[]; 64 static const char kEngagementScoreHistogramIsZero[];
62 static const char kOriginsWithMaxEngagementHistogram[]; 65 static const char kOriginsWithMaxEngagementHistogram[];
63 static const char kOriginsWithMaxDailyEngagementHistogram[]; 66 static const char kOriginsWithMaxDailyEngagementHistogram[];
64 static const char kPercentOriginsWithMaxEngagementHistogram[]; 67 static const char kPercentOriginsWithMaxEngagementHistogram[];
65 static const char kEngagementTypeHistogram[]; 68 static const char kEngagementTypeHistogram[];
66 static const char kEngagementBucketHistogramBase[]; 69 static const char kEngagementBucketHistogramBase[];
67 static const char kDaysSinceLastShortcutLaunchHistogram[]; 70 static const char kDaysSinceLastShortcutLaunchHistogram[];
68 static const char kScoreDecayedFromHistogram[]; 71 static const char kScoreDecayedFromHistogram[];
69 static const char kScoreDecayedToHistogram[]; 72 static const char kScoreDecayedToHistogram[];
70 73
71 static std::vector<std::string> GetEngagementBucketHistogramNames(); 74 static std::vector<std::string> GetEngagementBucketHistogramNames();
72 }; 75 };
73 76
74 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_METRICS_H_ 77 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_METRICS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698