Commit a107a161 authored by Dan Harrington's avatar Dan Harrington Committed by Commit Bot

Feed v2: more user interactions

- Learn more, send feedback, download page
- Each counts as a feed interaction (Feed.EngagementType)
- We'll add histogram or user actions for these events later.

Bug: 1044139
Change-Id: I4965f637abdbff6f6630d88a28e7814ef7ef59ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2138236
Commit-Queue: Dan H <harringtond@chromium.org>
Reviewed-by: default avatarCarlos Knippschild <carlosk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758019}
parent 66d0ab6e
......@@ -131,6 +131,12 @@ public class FeedStreamSurface implements SurfaceActionsHandler, FeedActionsHand
void reportSliceViewed(
long nativeFeedStreamSurface, FeedStreamSurface caller, String sliceId);
// TODO(jianli): Call this function at the appropriate time.
void reportSendFeedbackAction(long nativeFeedStreamSurface, FeedStreamSurface caller);
// TODO(jianli): Call this function at the appropriate time.
void reportLearnMoreAction(long nativeFeedStreamSurface, FeedStreamSurface caller);
// TODO(jianli): Call this function at the appropriate time.
void reportDownloadAction(long nativeFeedStreamSurface, FeedStreamSurface caller);
// TODO(jianli): Call this function at the appropriate time.
void reportNavigationDone(long nativeFeedStreamSurface, FeedStreamSurface caller,
String url, boolean inNewTab);
// TODO(jianli): Call this function at the appropriate time.
......
......@@ -99,6 +99,23 @@ void FeedStreamSurface::ReportSliceViewed(
base::android::ConvertJavaStringToUTF8(env, slice_id));
}
void FeedStreamSurface::ReportSendFeedbackAction(
JNIEnv* env,
const JavaParamRef<jobject>& obj) {
feed_stream_api_->ReportSendFeedbackAction();
}
void FeedStreamSurface::ReportLearnMoreAction(
JNIEnv* env,
const JavaParamRef<jobject>& obj) {
feed_stream_api_->ReportLearnMoreAction();
}
void FeedStreamSurface::ReportDownloadAction(JNIEnv* env,
const JavaParamRef<jobject>& obj) {
feed_stream_api_->ReportDownloadAction();
}
void FeedStreamSurface::ReportNavigationStarted(
JNIEnv* env,
const JavaParamRef<jobject>& obj,
......
......@@ -58,35 +58,34 @@ class FeedStreamSurface : public FeedStreamApi::SurfaceInterface {
// Event reporting functions. These have no side-effect beyond recording
// metrics. See FeedStreamApi for definitions.
void ReportSliceViewed(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jstring>& slice_id);
void ReportSendFeedbackAction(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
void ReportLearnMoreAction(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
void ReportDownloadAction(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
void ReportNavigationStarted(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jstring>& url,
jboolean in_new_tab);
void ReportNavigationDone(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jstring>& url,
jboolean in_new_tab);
void ReportRemoveAction(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
void ReportNotInterestedInAction(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
void ReportManageInterestsAction(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
void ReportContextMenuOpened(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
void ReportStreamScrolled(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
int distance_dp);
......
......@@ -481,6 +481,15 @@ void FeedStream::ReportSliceViewed(const std::string& slice_id) {
metrics_reporter_->ContentSliceViewed(index);
}
void FeedStream::ReportSendFeedbackAction() {
metrics_reporter_->SendFeedbackAction();
}
void FeedStream::ReportLearnMoreAction() {
metrics_reporter_->LearnMoreAction();
}
void FeedStream::ReportDownloadAction() {
metrics_reporter_->DownloadAction();
}
void FeedStream::ReportNavigationStarted() {
metrics_reporter_->NavigationStarted();
}
......
......@@ -109,6 +109,9 @@ class FeedStream : public FeedStreamApi,
bool RejectEphemeralChange(EphemeralChangeId id) override;
void ReportSliceViewed(const std::string& slice_id) override;
void ReportSendFeedbackAction() override;
void ReportLearnMoreAction() override;
void ReportDownloadAction() override;
void ReportNavigationStarted() override;
void ReportNavigationDone() override;
void ReportRemoveAction() override;
......
......@@ -79,6 +79,21 @@ void MetricsReporter::ContentSliceViewed(int index_in_stream) {
index_in_stream, kMaxSuggestionsTotal);
}
void MetricsReporter::SendFeedbackAction() {
// TODO(harringtond): Report UMA/UserAction for this.
RecordInteraction();
}
void MetricsReporter::DownloadAction() {
// TODO(harringtond): Report UMA/UserAction for this.
RecordInteraction();
}
void MetricsReporter::LearnMoreAction() {
// TODO(harringtond): Report UMA/UserAction for this.
RecordInteraction();
}
void MetricsReporter::NavigationStarted() {
// TODO(harringtond): Add user actions.
// Report Feed_OpeningContent
......
......@@ -36,9 +36,12 @@ class MetricsReporter : public FeedStream::EventObserver {
MetricsReporter(const MetricsReporter&) = delete;
MetricsReporter& operator=(const MetricsReporter&) = delete;
// User interactions.
// User interactions. See |FeedStreamApi| for definitions.
virtual void ContentSliceViewed(int index_in_stream);
void SendFeedbackAction();
void LearnMoreAction();
void DownloadAction();
void NavigationStarted();
void NavigationDone();
void RemoveAction();
......
......@@ -60,6 +60,13 @@ class FeedStreamApi {
// A slice was viewed (2/3rds of it is in the viewport). Should be called
// once for each viewed slice in the stream.
virtual void ReportSliceViewed(const std::string& slice_id) = 0;
// The user pressed the 'send feedback' context menu option, but may have not
// completed the feedback process.
virtual void ReportSendFeedbackAction() = 0;
// The user selected the 'learn more' option on the context menu.
virtual void ReportLearnMoreAction() = 0;
// The user selected the 'download' option on the context menu.
virtual void ReportDownloadAction() = 0;
virtual void ReportNavigationStarted() = 0;
virtual void ReportNavigationDone() = 0;
// A piece of content was removed or dismissed explicitly by the user.
......
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