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

Unified Diff: components/ntp_snippets/content_suggestions_metrics.cc

Issue 2707783004: [remote suggestions] Add a new histogram for recording the time since a snippet was fetched. (Closed)
Patch Set: '"' Created 3 years, 10 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/content_suggestions_metrics.cc
diff --git a/components/ntp_snippets/content_suggestions_metrics.cc b/components/ntp_snippets/content_suggestions_metrics.cc
index 95a1381cc08ef963bcdad3cefe72076adce86337..ba6f2b30bc0b7b59ebafb038d463c134ad9439b0 100644
--- a/components/ntp_snippets/content_suggestions_metrics.cc
+++ b/components/ntp_snippets/content_suggestions_metrics.cc
@@ -61,6 +61,8 @@ const char kHistogramCategoryDismissed[] =
"NewTabPage.ContentSuggestions.CategoryDismissed";
const char kHistogramContentSuggestionsTimeSinceLastBackgroundFetch[] =
"NewTabPage.ContentSuggestions.TimeSinceLastBackgroundFetch";
+const char kHistogramContentSuggestionsTimeSinceSuggestionFetched[] =
Marc Treib 2017/02/21 09:14:09 optional nit: You could remove "ContentSuggestions
markusheintz_ 2017/02/21 11:31:50 Done.
+ "NewTabPage.ContentSuggestions.TimeSinceSuggestionFetched";
const char kPerCategoryHistogramFormat[] = "%s.%s";
@@ -235,6 +237,13 @@ void OnSuggestionShown(int global_position,
LogCategoryHistogramScore(kHistogramShownScore, category, score);
+ // Records the time since the fetch time of the displayed snippet.
+ UMA_HISTOGRAM_CUSTOM_TIMES(
+ kHistogramContentSuggestionsTimeSinceSuggestionFetched,
+ base::Time::Now() - fetch_date, base::TimeDelta::FromSeconds(1),
+ base::TimeDelta::FromDays(7),
+ /*bucket_count=*/100);
Marc Treib 2017/02/21 09:14:09 Should we record this only for ARTICLES? If not, s
markusheintz_ 2017/02/21 11:31:50 Done. No the fetch date for non Article suggestio
+
// TODO(markusheintz): Discuss whether the code below should be move into a
// separate method called OnSuggestionsListShown.
// When the first of the articles suggestions is shown, then we count this as
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698