Commit 21c5491b authored by Theresa's avatar Theresa Committed by Commit Bot

[EoC] Notify feature enagement system when suggestion is taken

Notify the feature engagement system when a suggestion is clicked,
opened in a new tab or downloaded using a single
'contextual_suggestion_taken' event.

BUG=901915

Change-Id: Iaf5ed83f8a7e36b044541cfe96d3cc4a9fd34d4b
Reviewed-on: https://chromium-review.googlesource.com/c/1321864Reviewed-by: default avatarBecky Zhou <huayinz@chromium.org>
Reviewed-by: default avatarTommy Nyquist <nyquist@chromium.org>
Commit-Queue: Theresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606082}
parent 4b54c4e5
...@@ -5,11 +5,14 @@ ...@@ -5,11 +5,14 @@
package org.chromium.chrome.browser.contextual_suggestions; package org.chromium.chrome.browser.contextual_suggestions;
import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.browser.feature_engagement.TrackerFactory;
import org.chromium.chrome.browser.ntp.cards.ActionItem; import org.chromium.chrome.browser.ntp.cards.ActionItem;
import org.chromium.chrome.browser.ntp.snippets.SnippetArticle; import org.chromium.chrome.browser.ntp.snippets.SnippetArticle;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.suggestions.SuggestionsEventReporter; import org.chromium.chrome.browser.suggestions.SuggestionsEventReporter;
import org.chromium.chrome.browser.suggestions.SuggestionsRanker; import org.chromium.chrome.browser.suggestions.SuggestionsRanker;
import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.components.feature_engagement.EventConstants;
import org.chromium.ui.mojom.WindowOpenDisposition; import org.chromium.ui.mojom.WindowOpenDisposition;
/** Reports events related to contextual suggestions. */ /** Reports events related to contextual suggestions. */
...@@ -47,6 +50,8 @@ class ContextualSuggestionsEventReporter implements SuggestionsEventReporter { ...@@ -47,6 +50,8 @@ class ContextualSuggestionsEventReporter implements SuggestionsEventReporter {
: ContextualSuggestionsEvent.SUGGESTION_CLICKED; : ContextualSuggestionsEvent.SUGGESTION_CLICKED;
mSuggestionSource.reportEvent(mTabModelSelector.getCurrentTab().getWebContents(), eventId); mSuggestionSource.reportEvent(mTabModelSelector.getCurrentTab().getWebContents(), eventId);
TrackerFactory.getTrackerForProfile(Profile.getLastUsedProfile())
.notifyEvent(EventConstants.CONTEXTUAL_SUGGESTION_TAKEN);
RecordHistogram.recordSparseHistogram( RecordHistogram.recordSparseHistogram(
"ContextualSuggestions.SuggestionClickPosition.Global", suggestion.getGlobalRank()); "ContextualSuggestions.SuggestionClickPosition.Global", suggestion.getGlobalRank());
RecordHistogram.recordSparseHistogram( RecordHistogram.recordSparseHistogram(
......
...@@ -51,9 +51,9 @@ public final class EventConstants { ...@@ -51,9 +51,9 @@ public final class EventConstants {
public static final String CONTEXTUAL_SUGGESTIONS_OPENED = "contextual_suggestions_opened"; public static final String CONTEXTUAL_SUGGESTIONS_OPENED = "contextual_suggestions_opened";
/** /**
* The contextual suggestions bottom sheet was shown in its peeking state. * A contextual suggestion was clicked, opened in a new tab or downloaded.
*/ */
public static final String CONTEXTUAL_SUGGESTIONS_PEEKED = "contextual_suggestions_peeked"; public static final String CONTEXTUAL_SUGGESTION_TAKEN = "contextual_suggestion_taken";
/** /**
* Screenshot is taken with Chrome in the foreground. * Screenshot is taken with Chrome in the foreground.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment