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 4f61eed1fa9af77c9dbb0f6ea8386caaae14bbf1..b95c0de2b1b771ce0e27264c62839cf085b61730 100644 |
| --- a/components/ntp_snippets/content_suggestions_metrics.cc |
| +++ b/components/ntp_snippets/content_suggestions_metrics.cc |
| @@ -20,6 +20,7 @@ namespace { |
| const int kMaxSuggestionsPerCategory = 10; |
| const int kMaxSuggestionsTotal = 50; |
| +const int kMaxCategories = 20; |
|
Marc Treib
2017/01/16 10:45:42
This seems a bit excessive - I don't think we'll e
vitaliii
2017/01/18 09:19:20
Is there any downside of overestimating it?
We may
Marc Treib
2017/01/18 09:30:04
Well, the histogram will use more memory, probably
vitaliii
2017/01/18 09:36:30
Done, 10 now.
|
| const char kHistogramCountOnNtpOpened[] = |
| "NewTabPage.ContentSuggestions.CountOnNtpOpened"; |
| @@ -28,6 +29,8 @@ const char kHistogramShownAge[] = "NewTabPage.ContentSuggestions.ShownAge"; |
| const char kHistogramShownScore[] = "NewTabPage.ContentSuggestions.ShownScore"; |
| const char kHistogramOpened[] = "NewTabPage.ContentSuggestions.Opened"; |
| const char kHistogramOpenedAge[] = "NewTabPage.ContentSuggestions.OpenedAge"; |
| +const char kHistogramOpenedCategoryRank[] = |
| + "NewTabPage.ContentSuggestions.OpenedCategoryRank"; |
| const char kHistogramOpenedScore[] = |
| "NewTabPage.ContentSuggestions.OpenedScore"; |
| const char kHistogramOpenDisposition[] = |
| @@ -248,13 +251,14 @@ void OnPageShown( |
| void OnSuggestionShown(int global_position, |
| Category category, |
| - int category_position, |
| + int position_in_category, |
| base::Time publish_date, |
| base::Time last_background_fetch_time, |
| float score) { |
| UMA_HISTOGRAM_ENUMERATION(kHistogramShown, global_position, |
| kMaxSuggestionsTotal); |
| - LogCategoryHistogramEnumeration(kHistogramShown, category, category_position, |
| + LogCategoryHistogramEnumeration(kHistogramShown, category, |
| + position_in_category, |
| kMaxSuggestionsPerCategory); |
| base::TimeDelta age = base::Time::Now() - publish_date; |
| @@ -267,7 +271,7 @@ void OnSuggestionShown(int global_position, |
| // 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) { |
| + position_in_category == 0) { |
| RecordContentSuggestionsUsage(); |
| // Records the time since the last background fetch of the remote content |
| @@ -282,13 +286,20 @@ void OnSuggestionShown(int global_position, |
| void OnSuggestionOpened(int global_position, |
| Category category, |
| - int category_position, |
| + int category_rank, |
| + int position_in_category, |
| base::Time publish_date, |
| float score, |
| WindowOpenDisposition disposition) { |
| + UMA_HISTOGRAM_ENUMERATION(kHistogramOpenedCategoryRank, category_rank, |
| + kMaxCategories); |
| + LogCategoryHistogramEnumeration(kHistogramOpenedCategoryRank, category, |
| + category_rank, kMaxCategories); |
| + |
| UMA_HISTOGRAM_ENUMERATION(kHistogramOpened, global_position, |
| kMaxSuggestionsTotal); |
| - LogCategoryHistogramEnumeration(kHistogramOpened, category, category_position, |
| + LogCategoryHistogramEnumeration(kHistogramOpened, category, |
| + position_in_category, |
| kMaxSuggestionsPerCategory); |
| base::TimeDelta age = base::Time::Now() - publish_date; |
| @@ -310,13 +321,13 @@ void OnSuggestionOpened(int global_position, |
| void OnSuggestionMenuOpened(int global_position, |
| Category category, |
| - int category_position, |
| + int position_in_category, |
| base::Time publish_date, |
| float score) { |
| UMA_HISTOGRAM_ENUMERATION(kHistogramMenuOpened, global_position, |
| kMaxSuggestionsTotal); |
| LogCategoryHistogramEnumeration(kHistogramMenuOpened, category, |
| - category_position, |
| + position_in_category, |
| kMaxSuggestionsPerCategory); |
| base::TimeDelta age = base::Time::Now() - publish_date; |
| @@ -327,19 +338,19 @@ void OnSuggestionMenuOpened(int global_position, |
| void OnSuggestionDismissed(int global_position, |
| Category category, |
| - int category_position, |
| + int position_in_category, |
| bool visited) { |
| if (visited) { |
| UMA_HISTOGRAM_ENUMERATION(kHistogramDismissedVisited, global_position, |
| kMaxSuggestionsTotal); |
| LogCategoryHistogramEnumeration(kHistogramDismissedVisited, category, |
| - category_position, |
| + position_in_category, |
| kMaxSuggestionsPerCategory); |
| } else { |
| UMA_HISTOGRAM_ENUMERATION(kHistogramDismissedUnvisited, global_position, |
| kMaxSuggestionsTotal); |
| LogCategoryHistogramEnumeration(kHistogramDismissedUnvisited, category, |
| - category_position, |
| + position_in_category, |
| kMaxSuggestionsPerCategory); |
| } |
| } |