content_suggestions_metrics.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_METRICS_H_
  5. #define COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_METRICS_H_
  6. #include <utility>
  7. #include <vector>
  8. #include "base/time/time.h"
  9. #include "components/ntp_snippets/category.h"
  10. #include "ui/base/window_open_disposition.h"
  11. namespace ntp_snippets {
  12. namespace metrics {
  13. // |is_category_visible| contains true iff the corresponding category can be
  14. // seen by the user on this page (even if it is empty). It does not depend on
  15. // whether the user actually saw the category.
  16. void OnPageShown(const std::vector<Category>& categories,
  17. const std::vector<int>& suggestions_per_category,
  18. const std::vector<bool>& is_category_visible);
  19. // Should only be called once per NTP for each suggestion.
  20. void OnSuggestionShown(int global_position,
  21. Category category,
  22. int position_in_category,
  23. base::Time publish_date,
  24. float score,
  25. base::Time fetch_date);
  26. // TODO(crbug.com/682160): Take struct, so that one could not mix up the
  27. // order of arguments.
  28. void OnSuggestionOpened(int global_position,
  29. Category category,
  30. int category_index,
  31. int position_in_category,
  32. base::Time publish_date,
  33. float score,
  34. WindowOpenDisposition disposition,
  35. bool is_prefetched,
  36. bool is_offline);
  37. void OnSuggestionMenuOpened(int global_position,
  38. Category category,
  39. int position_in_category,
  40. base::Time publish_date,
  41. float score);
  42. void OnSuggestionDismissed(int global_position,
  43. Category category,
  44. int position_in_category,
  45. bool visited);
  46. void OnSuggestionTargetVisited(Category category, base::TimeDelta visit_time);
  47. void OnCategoryMovedUp(int new_index);
  48. // Should only be called once per NTP for each "more" button.
  49. void OnMoreButtonShown(Category category, int position);
  50. void OnMoreButtonClicked(Category category, int position);
  51. void OnCategoryDismissed(Category category);
  52. void RecordRemoteSuggestionsProviderState(bool enabled);
  53. void RecordContentSuggestionDismissed();
  54. void RecordCategoryDismissed();
  55. void RecordFetchAction();
  56. } // namespace metrics
  57. } // namespace ntp_snippets
  58. #endif // COMPONENTS_NTP_SNIPPETS_CONTENT_SUGGESTIONS_METRICS_H_