Bug 1402005: Add telemetry for Learn More clicks. r=liuche

MozReview-Commit-ID: GA4UBZ4fpK6

--HG--
extra : rebase_source : 4803bd6eb9c97d0ae89b6322658e2cf0273e4e20
This commit is contained in:
Michael Comella 2017-09-22 17:32:03 -07:00
Родитель d1ac60c027
Коммит 71347fe090
3 изменённых файлов: 28 добавлений и 1 удалений

Просмотреть файл

@ -39,6 +39,7 @@ public class ActivityStreamTelemetry {
public final static String TYPE_TOPSITES = "topsites";
public final static String TYPE_HIGHLIGHTS = "highlights";
public final static String TYPE_POCKET = "pocket";
public final static String TYPE_LEARN_MORE = "learn_more";
public final static String SUBTYPE_PINNED = "pinned";
public final static String SUBTYPE_SUGGESTED = "suggested";
public final static String SUBTYPE_TOP = "top";

Просмотреть файл

@ -10,6 +10,10 @@ import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.Locales;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
import org.mozilla.gecko.activitystream.ActivityStream;
import org.mozilla.gecko.activitystream.ActivityStreamTelemetry;
import java.util.Locale;
@ -44,8 +48,8 @@ public class LearnMoreRow extends StreamViewHolder {
learnMoreLink.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
// todo: add telemetry.
Tabs.getInstance().loadUrl(getLearnMoreURL());
sendOnClickTelemetry();
}
});
}
@ -63,4 +67,14 @@ public class LearnMoreRow extends StreamViewHolder {
return String.format(LEARN_MORE_URL_TEMPLATE, VERSION, OS, LOCALE);
}
private static void sendOnClickTelemetry() {
ActivityStreamTelemetry.Extras.Builder extras = ActivityStreamTelemetry.Extras.builder()
.set(ActivityStreamTelemetry.Contract.SOURCE_TYPE, ActivityStreamTelemetry.Contract.TYPE_LEARN_MORE);
Telemetry.sendUIEvent(
TelemetryContract.Event.LOAD_URL,
TelemetryContract.Method.LIST_ITEM,
extras.build());
}
}

Просмотреть файл

@ -164,6 +164,18 @@ Possible values for "item" key (names of menu items), in no particular order:
- "dismiss"
- "delete"
Learn More interactions
-----------------------
A click on the "Learn more" link is recorded using: event="loadurl.1", method="listitem".
In addition to the global extras, the following information is recorded:
.. code-block:: js
extras: {
"source_type": "learn_more"
}
Full Examples
=============
Following examples of events are here to provide a better feel for the overall shape of telemetry data being recorded.