OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/engagement/site_engagement_metrics.h" | |
6 | |
7 #include "base/metrics/histogram_macros.h" | |
8 #include "base/metrics/sparse_histogram.h" | |
9 | |
10 void SiteEngagementMetrics::RecordTotalCumulativeSiteEngagement( | |
11 double total_engagement) { | |
12 UMA_HISTOGRAM_COUNTS_100("SiteEngagementService.CumulativeTotal", | |
13 total_engagement); | |
14 } | |
15 | |
16 void SiteEngagementMetrics::RecordTotalOriginsEngaged(int num_origins) { | |
17 UMA_HISTOGRAM_COUNTS_100("SiteEngagementService.OriginsEngaged", num_origins); | |
18 } | |
19 | |
20 void SiteEngagementMetrics::RecordEngagementPerOrigin( | |
21 std::map<GURL, double> score_map) { | |
22 for (const auto& value: score_map) { | |
23 UMA_HISTOGRAM_COUNTS_100("SiteEngagementService.EngagementPerOrigin", | |
24 value.second); | |
25 } | |
26 } | |
27 | |
28 void SiteEngagementMetrics::RecordOriginsWithMaxEngagement(int total_origins) { | |
29 UMA_HISTOGRAM_COUNTS_100("SiteEngagementService.OriginsWithMaxEngagement", | |
30 total_origins); | |
31 } | |
32 | |
33 void SiteEngagementMetrics::RecordOriginsWithMaxDailyEngagement( | |
34 int total_origins) { | |
35 UMA_HISTOGRAM_COUNTS_100( | |
36 "SiteEngagementService.OriginsWithMaxDailyEngagement", total_origins); | |
37 } | |
38 | |
39 void SiteEngagementMetrics::RecordEngagement(EngagementType type) { | |
40 switch (type) { | |
41 case ENGAGEMENT_NAVIGATION: | |
42 UMA_HISTOGRAM_SPARSE_SLOWLY("SiteEngagementService.EngagementType", | |
calamity
2015/09/25 07:08:33
So what does SPARSE_SLOWLY do?
dominickn
2015/09/28 03:34:50
asvitkine recommend that I use it instead of UMA_H
calamity
2015/09/28 07:33:47
Acknowledged.
| |
43 ENGAGEMENT_NAVIGATION); | |
44 break; | |
45 case ENGAGEMENT_KEYPRESS: | |
46 UMA_HISTOGRAM_SPARSE_SLOWLY("SiteEngagementService.EngagementType", | |
calamity
2015/09/25 07:08:33
Pull into a local constant.
dominickn
2015/09/28 03:34:50
Done.
| |
47 ENGAGEMENT_KEYPRESS); | |
48 break; | |
49 case ENGAGEMENT_MOUSE: | |
50 UMA_HISTOGRAM_SPARSE_SLOWLY("SiteEngagementService.EngagementType", | |
51 ENGAGEMENT_MOUSE); | |
52 break; | |
53 default: | |
54 NOTREACHED() << "Invalid type passed to RecordUserInput()."; | |
55 break; | |
56 } | |
57 } | |
OLD | NEW |