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

Unified Diff: components/ntp_tiles/metrics.cc

Issue 2557513007: ntp_tiles::metrics: Add rappor metrics for impression URLs per icon type. (Closed)
Patch Set: Rebased. Created 4 years 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
« no previous file with comments | « components/ntp_tiles/metrics.h ('k') | components/ntp_tiles/metrics_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_tiles/metrics.cc
diff --git a/components/ntp_tiles/metrics.cc b/components/ntp_tiles/metrics.cc
index 1b9a64fced2270fe4c4c98d9d102f7852232409a..e407af25715fac4eb4370462e687af960b69d18e 100644
--- a/components/ntp_tiles/metrics.cc
+++ b/components/ntp_tiles/metrics.cc
@@ -10,6 +10,7 @@
#include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h"
#include "base/strings/stringprintf.h"
+#include "components/rappor/public/rappor_utils.h"
namespace ntp_tiles {
namespace metrics {
@@ -55,15 +56,16 @@ std::string GetSourceHistogramName(NTPTileSource source) {
} // namespace
-void RecordPageImpression(
- const std::vector<std::pair<NTPTileSource, MostVisitedTileType>>& tiles) {
+void RecordPageImpression(const std::vector<TileImpression>& tiles,
+ rappor::RapporService* rappor_service) {
UMA_HISTOGRAM_SPARSE_SLOWLY("NewTabPage.NumberOfTiles", tiles.size());
int counts_per_type[NUM_RECORDED_TILE_TYPES] = {0};
bool have_tile_types = false;
for (int index = 0; index < static_cast<int>(tiles.size()); index++) {
- NTPTileSource source = tiles[index].first;
- MostVisitedTileType tile_type = tiles[index].second;
+ NTPTileSource source = tiles[index].source;
+ MostVisitedTileType tile_type = tiles[index].type;
+ const GURL& url = tiles[index].url;
UMA_HISTOGRAM_ENUMERATION("NewTabPage.SuggestionsImpression", index,
kMaxNumTiles);
@@ -86,6 +88,27 @@ void RecordPageImpression(
std::string tile_type_histogram =
base::StringPrintf("NewTabPage.TileType.%s", source_name.c_str());
LogHistogramEvent(tile_type_histogram, tile_type, NUM_RECORDED_TILE_TYPES);
+
+ switch (tile_type) {
+ case NONE:
+ break;
+ case ICON_COLOR:
+ rappor::SampleDomainAndRegistryFromGURL(
+ rappor_service, "NTP.SuggestionsImpressions.IconsColor", url);
+ break;
+ case ICON_DEFAULT:
+ rappor::SampleDomainAndRegistryFromGURL(
+ rappor_service, "NTP.SuggestionsImpressions.IconsGray", url);
+ break;
+ case ICON_REAL:
+ rappor::SampleDomainAndRegistryFromGURL(
+ rappor_service, "NTP.SuggestionsImpressions.IconsReal", url);
+ break;
+ case NUM_RECORDED_TILE_TYPES: // Fall through.
+ case THUMBNAIL: // Fall through.
+ case UNKNOWN_TILE_TYPE:
+ NOTREACHED();
+ }
}
if (have_tile_types) {
« no previous file with comments | « components/ntp_tiles/metrics.h ('k') | components/ntp_tiles/metrics_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698