Chromium Code Reviews| 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); |
| } |
| } |