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 33d61743ca4a5a31b617d7eda8f0842074a26c4f..a7ec471f0725cec946da84abc4dea11e3beb0bd5 100644 |
| --- a/components/ntp_snippets/content_suggestions_metrics.cc |
| +++ b/components/ntp_snippets/content_suggestions_metrics.cc |
| @@ -51,6 +51,8 @@ const char kHistogramMoreButtonClicked[] = |
| "NewTabPage.ContentSuggestions.MoreButtonClicked"; |
| const char kHistogramCategoryDismissed[] = |
| "NewTabPage.ContentSuggestions.CategoryDismissed"; |
| +const char kHistogramContentSuggestionsBackgroundFetchAge[] = |
| + "NewTabPage.ContentSuggestions.BackgroundFetchAge"; |
|
Marc Treib
2016/12/15 10:16:41
nit: I'm not super happy with the term "Age" here
markusheintz_
2016/12/15 12:42:07
Excellent name suggestion!! I find it much better
|
| const char kPerCategoryHistogramFormat[] = "%s.%s"; |
| @@ -248,6 +250,7 @@ void OnSuggestionShown(int global_position, |
| Category category, |
| int category_position, |
| base::Time publish_date, |
| + base::Time last_background_fetch_time, |
| float score) { |
| UMA_HISTOGRAM_ENUMERATION(kHistogramShown, global_position, |
| kMaxSuggestionsTotal); |
| @@ -259,11 +262,23 @@ void OnSuggestionShown(int global_position, |
| LogCategoryHistogramScore(kHistogramShownScore, category, score); |
| + // 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 |
| // a single usage of content suggestions. |
| if (category.IsKnownCategory(KnownCategories::ARTICLES) && |
| category_position == 0) { |
| RecordContentSuggestionsUsage(); |
| + |
| + // Records the age of the remote content suggestion based on the last |
| + // background fetch time. This is different from the actual content age as |
|
Marc Treib
2016/12/15 10:16:41
Also here: It's not the age of the suggestion, it'
markusheintz_
2016/12/15 12:42:07
That's what I describe in the comment. I simplifie
|
| + // it records the time span between fetching the suggestions and viewing |
| + // them. |
| + UMA_HISTOGRAM_CUSTOM_TIMES(kHistogramContentSuggestionsBackgroundFetchAge, |
| + base::Time::Now() - last_background_fetch_time, |
| + base::TimeDelta::FromSeconds(1), |
| + base::TimeDelta::FromDays(3), |
| + /*bucket_count=*/100); |
| } |
| } |