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

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: Address comments of comments 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..91fedbdc4368263766c58b76e2fd8a733aa049d6 100644
--- a/components/ntp_snippets/content_suggestions_metrics.cc
+++ b/components/ntp_snippets/content_suggestions_metrics.cc
@@ -59,8 +59,8 @@ const char kHistogramMovedUpCategoryNewIndex[] =
"NewTabPage.ContentSuggestions.MovedUpCategoryNewIndex";
const char kHistogramCategoryDismissed[] =
"NewTabPage.ContentSuggestions.CategoryDismissed";
-const char kHistogramContentSuggestionsTimeSinceLastBackgroundFetch[] =
- "NewTabPage.ContentSuggestions.TimeSinceLastBackgroundFetch";
+const char kHistogramTimeSinceSuggestionFetched[] =
+ "NewTabPage.ContentSuggestions.TimeSinceSuggestionFetched";
const char kPerCategoryHistogramFormat[] = "%s.%s";
@@ -235,6 +235,14 @@ void OnSuggestionShown(int global_position,
LogCategoryHistogramScore(kHistogramShownScore, category, score);
+ if (category.IsKnownCategory(KnownCategories::ARTICLES)) {
+ // Records the time since the fetch time of the displayed snippet.
+ UMA_HISTOGRAM_CUSTOM_TIMES(
+ kHistogramTimeSinceSuggestionFetched, base::Time::Now() - fetch_date,
+ base::TimeDelta::FromDays(0), base::TimeDelta::FromDays(7),
Marc Treib 2017/02/22 13:38:11 I think the min value can't be 0. FromSeconds(1)?
markusheintz_ 2017/02/22 13:42:04 done. already uploaded. sry I forgot
+ /*bucket_count=*/100);
+ }
+
// 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
@@ -242,14 +250,6 @@ void OnSuggestionShown(int global_position,
if (category.IsKnownCategory(KnownCategories::ARTICLES) &&
position_in_category == 0) {
RecordContentSuggestionsUsage();
-
- // Records the time since the last background fetch of the remote content
- // suggestions.
- UMA_HISTOGRAM_CUSTOM_TIMES(
- kHistogramContentSuggestionsTimeSinceLastBackgroundFetch,
- base::Time::Now() - fetch_date, base::TimeDelta::FromSeconds(1),
- base::TimeDelta::FromDays(7),
- /*bucket_count=*/100);
}
}
« 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