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

Side by Side Diff: components/ntp_snippets/content_suggestions_metrics.cc

Issue 2668063004: [NTP::SectionOrder] Track category index after it has been moved up. (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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/ntp_snippets/content_suggestions_metrics.h" 5 #include "components/ntp_snippets/content_suggestions_metrics.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <string> 8 #include <string>
9 #include <type_traits> 9 #include <type_traits>
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 const char kHistogramDismissedVisited[] = 48 const char kHistogramDismissedVisited[] =
49 "NewTabPage.ContentSuggestions.DismissedVisited"; 49 "NewTabPage.ContentSuggestions.DismissedVisited";
50 const char kHistogramArticlesUsageTimeLocal[] = 50 const char kHistogramArticlesUsageTimeLocal[] =
51 "NewTabPage.ContentSuggestions.UsageTimeLocal"; 51 "NewTabPage.ContentSuggestions.UsageTimeLocal";
52 const char kHistogramVisitDuration[] = 52 const char kHistogramVisitDuration[] =
53 "NewTabPage.ContentSuggestions.VisitDuration"; 53 "NewTabPage.ContentSuggestions.VisitDuration";
54 const char kHistogramMoreButtonShown[] = 54 const char kHistogramMoreButtonShown[] =
55 "NewTabPage.ContentSuggestions.MoreButtonShown"; 55 "NewTabPage.ContentSuggestions.MoreButtonShown";
56 const char kHistogramMoreButtonClicked[] = 56 const char kHistogramMoreButtonClicked[] =
57 "NewTabPage.ContentSuggestions.MoreButtonClicked"; 57 "NewTabPage.ContentSuggestions.MoreButtonClicked";
58 const char kHistogramMovedUpCategoryNewIndex[] =
59 "NewTabPage.ContentSuggestions.MovedUpCategoryNewIndex";
Marc Treib 2017/02/01 13:04:23 ".CategoryMovedUpNewIndex"?
vitaliii 2017/02/01 13:30:18 I like previous one more. Which category? Moved u
Marc Treib 2017/02/01 13:40:46 Ah, I wasn't aware of OpenedCategoryIndex. I guess
vitaliii 2017/02/01 14:19:37 Acknowledged.
58 const char kHistogramCategoryDismissed[] = 60 const char kHistogramCategoryDismissed[] =
59 "NewTabPage.ContentSuggestions.CategoryDismissed"; 61 "NewTabPage.ContentSuggestions.CategoryDismissed";
60 const char kHistogramContentSuggestionsTimeSinceLastBackgroundFetch[] = 62 const char kHistogramContentSuggestionsTimeSinceLastBackgroundFetch[] =
61 "NewTabPage.ContentSuggestions.TimeSinceLastBackgroundFetch"; 63 "NewTabPage.ContentSuggestions.TimeSinceLastBackgroundFetch";
62 64
63 const char kPerCategoryHistogramFormat[] = "%s.%s"; 65 const char kPerCategoryHistogramFormat[] = "%s.%s";
64 66
65 // This mostly corresponds to the KnownCategories enum, but it is contiguous 67 // This mostly corresponds to the KnownCategories enum, but it is contiguous
66 // and contains exactly the values to be recorded in UMA. Don't remove or 68 // and contains exactly the values to be recorded in UMA. Don't remove or
67 // reorder elements, only add new ones at the end (before COUNT), and keep in 69 // reorder elements, only add new ones at the end (before COUNT), and keep in
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 kMaxSuggestionsPerCategory); 325 kMaxSuggestionsPerCategory);
324 } 326 }
325 } 327 }
326 328
327 void OnSuggestionTargetVisited(Category category, base::TimeDelta visit_time) { 329 void OnSuggestionTargetVisited(Category category, base::TimeDelta visit_time) {
328 std::string name = 330 std::string name =
329 GetCategoryHistogramName(kHistogramVisitDuration, category); 331 GetCategoryHistogramName(kHistogramVisitDuration, category);
330 base::UmaHistogramLongTimes(name, visit_time); 332 base::UmaHistogramLongTimes(name, visit_time);
331 } 333 }
332 334
335 void OnCategoryMovedUp(int new_index) {
336 UMA_HISTOGRAM_EXACT_LINEAR(kHistogramMovedUpCategoryNewIndex, new_index,
337 kMaxCategories);
Marc Treib 2017/02/01 13:04:23 Hm. I guess you'd mostly look at the number of sam
vitaliii 2017/02/01 13:30:18 Partially true. We are worried that top most categ
Marc Treib 2017/02/01 13:40:46 Alright, fair enough.
Marc Treib 2017/02/01 13:42:37 (About tracking only the top 3 or something: No, i
vitaliii 2017/02/01 14:19:37 Acknowledged. The mention of top 3 was to explain
338 }
339
333 void OnMoreButtonShown(Category category, int position) { 340 void OnMoreButtonShown(Category category, int position) {
334 // The "more" card can appear in addition to the actual suggestions, so add 341 // The "more" card can appear in addition to the actual suggestions, so add
335 // one extra bucket to this histogram. 342 // one extra bucket to this histogram.
336 LogCategoryHistogramPosition(kHistogramMoreButtonShown, category, position, 343 LogCategoryHistogramPosition(kHistogramMoreButtonShown, category, position,
337 kMaxSuggestionsPerCategory + 1); 344 kMaxSuggestionsPerCategory + 1);
338 } 345 }
339 346
340 void OnMoreButtonClicked(Category category, int position) { 347 void OnMoreButtonClicked(Category category, int position) {
341 // The "more" card can appear in addition to the actual suggestions, so add 348 // The "more" card can appear in addition to the actual suggestions, so add
342 // one extra bucket to this histogram. 349 // one extra bucket to this histogram.
343 LogCategoryHistogramPosition(kHistogramMoreButtonClicked, category, position, 350 LogCategoryHistogramPosition(kHistogramMoreButtonClicked, category, position,
344 kMaxSuggestionsPerCategory + 1); 351 kMaxSuggestionsPerCategory + 1);
345 } 352 }
346 353
347 void OnCategoryDismissed(Category category) { 354 void OnCategoryDismissed(Category category) {
348 UMA_HISTOGRAM_ENUMERATION(kHistogramCategoryDismissed, 355 UMA_HISTOGRAM_ENUMERATION(kHistogramCategoryDismissed,
349 GetHistogramCategory(category), 356 GetHistogramCategory(category),
350 HistogramCategories::COUNT); 357 HistogramCategories::COUNT);
351 } 358 }
352 359
353 } // namespace metrics 360 } // namespace metrics
354 } // namespace ntp_snippets 361 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/content_suggestions_metrics.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698