Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsMetricsReporter.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsMetricsReporter.java b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsMetricsReporter.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9165a0187f44bb9a7d263731952c372e1e2ea661 |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/suggestions/SuggestionsMetricsReporter.java |
| @@ -0,0 +1,67 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.chrome.browser.suggestions; |
| + |
| +import android.util.Pair; |
| + |
| +import org.chromium.chrome.browser.ntp.snippets.CategoryInt; |
| +import org.chromium.chrome.browser.ntp.snippets.SnippetArticle; |
| + |
| +/** |
| + * Exposes UMA related methods. |
| + */ |
| +public interface SuggestionsMetricsReporter { |
| + /** |
| + * Returns the rank of suggestion related elements. |
| + */ |
| + interface SuggestionRanker { |
| + /** @return The [rankInSection, globalRank] pair for the provided suggestion. */ |
| + Pair<Integer, Integer> getSuggestionRank(SnippetArticle suggestion); |
| + |
| + /** @return The rank pair for the action item of the section for the provided category. */ |
|
Bernhard Bauer
2017/01/13 10:56:07
This method doesn't return a pair.
dgn
2017/01/13 11:24:04
Oops thanks, done.
|
| + int getActionItemRank(@CategoryInt int category); |
| + } |
| + |
| + void setRanker(SuggestionRanker ranker); |
| + |
| + /** |
| + * Tracks per-page-load metrics for content suggestions. |
| + * @param categories The categories of content suggestions. |
| + * @param suggestionsPerCategory The number of content suggestions in each category. |
| + */ |
| + void onPageShown(int[] categories, int[] suggestionsPerCategory); |
| + |
| + /** |
| + * Tracks impression metrics for a content suggestion. |
| + * @param suggestion The content suggestion that was shown to the user. |
| + */ |
| + void onSuggestionShown(SnippetArticle suggestion); |
| + |
| + /** |
| + * Tracks interaction metrics for a content suggestion. |
| + * @param suggestion The content suggestion that the user opened. |
| + * @param windowOpenDisposition How the suggestion was opened (current tab, new tab, |
| + * new window etc). |
| + */ |
| + void onSuggestionOpened(SnippetArticle suggestion, int windowOpenDisposition); |
| + |
| + /** |
| + * Tracks impression metrics for the long-press menu for a content suggestion. |
| + * @param suggestion The content suggestion for which the long-press menu was opened. |
| + */ |
| + void onSuggestionMenuOpened(SnippetArticle suggestion); |
| + |
| + /** |
| + * Tracks impression metrics for a category's action button ("More"). |
| + * @param category The category for which the action button was shown. |
| + */ |
| + void onMoreButtonShown(@CategoryInt int category); |
| + |
| + /** |
| + * Tracks click metrics for a category's action button ("More"). |
| + * @param category The category for which the action button was clicked. |
| + */ |
| + void onMoreButtonClicked(@CategoryInt int category); |
| +} |