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

Side by Side Diff: components/ntp_tiles/metrics.cc

Issue 2785183002: Remove histograms NewTabPage.IconsReal/IconsColor/IconsGray (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/ntp_tiles/metrics_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "components/ntp_tiles/metrics.h" 5 #include "components/ntp_tiles/metrics.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 75 }
76 return nullptr; 76 return nullptr;
77 } 77 }
78 78
79 } // namespace 79 } // namespace
80 80
81 void RecordPageImpression(const std::vector<TileImpression>& tiles, 81 void RecordPageImpression(const std::vector<TileImpression>& tiles,
82 rappor::RapporService* rappor_service) { 82 rappor::RapporService* rappor_service) {
83 UMA_HISTOGRAM_SPARSE_SLOWLY("NewTabPage.NumberOfTiles", tiles.size()); 83 UMA_HISTOGRAM_SPARSE_SLOWLY("NewTabPage.NumberOfTiles", tiles.size());
84 84
85 int counts_per_type[NUM_RECORDED_TILE_TYPES] = {0};
86 bool have_tile_types = false;
87 for (int index = 0; index < static_cast<int>(tiles.size()); index++) { 85 for (int index = 0; index < static_cast<int>(tiles.size()); index++) {
88 NTPTileSource source = tiles[index].source; 86 NTPTileSource source = tiles[index].source;
89 MostVisitedTileType tile_type = tiles[index].type; 87 MostVisitedTileType tile_type = tiles[index].type;
90 const GURL& url = tiles[index].url; 88 const GURL& url = tiles[index].url;
91 89
92 UMA_HISTOGRAM_ENUMERATION("NewTabPage.SuggestionsImpression", index, 90 UMA_HISTOGRAM_ENUMERATION("NewTabPage.SuggestionsImpression", index,
93 kMaxNumTiles); 91 kMaxNumTiles);
94 92
95 std::string source_name = GetSourceHistogramName(source); 93 std::string source_name = GetSourceHistogramName(source);
96 std::string impression_histogram = base::StringPrintf( 94 std::string impression_histogram = base::StringPrintf(
97 "NewTabPage.SuggestionsImpression.%s", source_name.c_str()); 95 "NewTabPage.SuggestionsImpression.%s", source_name.c_str());
98 LogHistogramEvent(impression_histogram, index, kMaxNumTiles); 96 LogHistogramEvent(impression_histogram, index, kMaxNumTiles);
99 97
100 if (tile_type >= NUM_RECORDED_TILE_TYPES) { 98 if (tile_type >= NUM_RECORDED_TILE_TYPES) {
101 continue; 99 continue;
102 } 100 }
103 101
104 have_tile_types = true;
105 ++counts_per_type[tile_type];
106
107 UMA_HISTOGRAM_ENUMERATION("NewTabPage.TileType", tile_type, 102 UMA_HISTOGRAM_ENUMERATION("NewTabPage.TileType", tile_type,
108 NUM_RECORDED_TILE_TYPES); 103 NUM_RECORDED_TILE_TYPES);
109 104
110 std::string tile_type_histogram = 105 std::string tile_type_histogram =
111 base::StringPrintf("NewTabPage.TileType.%s", source_name.c_str()); 106 base::StringPrintf("NewTabPage.TileType.%s", source_name.c_str());
112 LogHistogramEvent(tile_type_histogram, tile_type, NUM_RECORDED_TILE_TYPES); 107 LogHistogramEvent(tile_type_histogram, tile_type, NUM_RECORDED_TILE_TYPES);
113 108
114 const char* icon_type_suffix = GetIconTypeSuffix(tile_type); 109 const char* icon_type_suffix = GetIconTypeSuffix(tile_type);
115 if (icon_type_suffix) { 110 if (icon_type_suffix) {
116 rappor::SampleDomainAndRegistryFromGURL( 111 rappor::SampleDomainAndRegistryFromGURL(
117 rappor_service, 112 rappor_service,
118 base::StringPrintf("NTP.SuggestionsImpressions.%s", icon_type_suffix), 113 base::StringPrintf("NTP.SuggestionsImpressions.%s", icon_type_suffix),
119 url); 114 url);
120 115
121 std::string icon_impression_histogram = base::StringPrintf( 116 std::string icon_impression_histogram = base::StringPrintf(
122 "NewTabPage.SuggestionsImpression.%s", icon_type_suffix); 117 "NewTabPage.SuggestionsImpression.%s", icon_type_suffix);
123 LogHistogramEvent(icon_impression_histogram, index, kMaxNumTiles); 118 LogHistogramEvent(icon_impression_histogram, index, kMaxNumTiles);
124 } 119 }
125 } 120 }
126
127 if (have_tile_types) {
128 UMA_HISTOGRAM_SPARSE_SLOWLY("NewTabPage.IconsReal",
129 counts_per_type[ICON_REAL]);
130 UMA_HISTOGRAM_SPARSE_SLOWLY("NewTabPage.IconsColor",
131 counts_per_type[ICON_COLOR]);
132 UMA_HISTOGRAM_SPARSE_SLOWLY("NewTabPage.IconsGray",
133 counts_per_type[ICON_DEFAULT]);
134 }
135 } 121 }
136 122
137 void RecordTileClick(int index, 123 void RecordTileClick(int index,
138 NTPTileSource source, 124 NTPTileSource source,
139 MostVisitedTileType tile_type) { 125 MostVisitedTileType tile_type) {
140 UMA_HISTOGRAM_ENUMERATION("NewTabPage.MostVisited", index, kMaxNumTiles); 126 UMA_HISTOGRAM_ENUMERATION("NewTabPage.MostVisited", index, kMaxNumTiles);
141 127
142 std::string histogram = base::StringPrintf( 128 std::string histogram = base::StringPrintf(
143 "NewTabPage.MostVisited.%s", GetSourceHistogramName(source).c_str()); 129 "NewTabPage.MostVisited.%s", GetSourceHistogramName(source).c_str());
144 LogHistogramEvent(histogram, index, kMaxNumTiles); 130 LogHistogramEvent(histogram, index, kMaxNumTiles);
(...skipping 11 matching lines...) Expand all
156 142
157 std::string histogram = 143 std::string histogram =
158 base::StringPrintf("NewTabPage.TileTypeClicked.%s", 144 base::StringPrintf("NewTabPage.TileTypeClicked.%s",
159 GetSourceHistogramName(source).c_str()); 145 GetSourceHistogramName(source).c_str());
160 LogHistogramEvent(histogram, tile_type, NUM_RECORDED_TILE_TYPES); 146 LogHistogramEvent(histogram, tile_type, NUM_RECORDED_TILE_TYPES);
161 } 147 }
162 } 148 }
163 149
164 } // namespace metrics 150 } // namespace metrics
165 } // namespace ntp_tiles 151 } // namespace ntp_tiles
OLDNEW
« no previous file with comments | « no previous file | components/ntp_tiles/metrics_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698