Bug 1004889 - Add UI telemetry for the main menu r=rnewman
authorMark Finkle <mfinkle@mozilla.com>
Fri, 02 May 2014 11:00:19 -0400
changeset 181418 cfd4a86b9ea86f5b0965f20565e72be4103ff158
parent 181417 479dbf1077ad2739d3b5c962d795479f0172020d
child 181419 62ead59d3f19b1ccceda9e1c41cb918f4e3fd836
push id26707
push userkwierso@gmail.com
push dateSat, 03 May 2014 05:54:14 +0000
treeherdermozilla-central@bdf3bcd18660 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs1004889
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1004889 - Add UI telemetry for the main menu r=rnewman
mobile/android/base/BrowserApp.java
mobile/android/base/TelemetryContract.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -2345,16 +2345,20 @@ abstract public class BrowserApp extends
 
     @Override
     public boolean onOptionsItemSelected(MenuItem item) {
         Tab tab = null;
         Intent intent = null;
 
         final int itemId = item.getItemId();
 
+        // Track the menu action. We don't know much about the context, but we can use this to determine
+        // the frequency of use for various actions.
+        Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.MENU, getResources().getResourceEntryName(itemId));
+
         if (itemId == R.id.bookmark) {
             tab = Tabs.getInstance().getSelectedTab();
             if (tab != null) {
                 if (item.isChecked()) {
                     tab.removeBookmark();
                     Toast.makeText(this, R.string.bookmark_removed, Toast.LENGTH_SHORT).show();
                     item.setIcon(R.drawable.ic_menu_bookmark_add);
                 } else {
--- a/mobile/android/base/TelemetryContract.java
+++ b/mobile/android/base/TelemetryContract.java
@@ -41,16 +41,19 @@ public interface TelemetryContract {
         public static final String SAVE = "save.1";
 
         // Stop holding a resource (reader, bookmark, etc) for viewing later.
         // Note: Only used in JavaScript for now, but here for completeness.
         public static final String UNSAVE = "unsave.1";
 
         // Loading a URL.
         public static final String LOAD_URL = "loadurl.1";
+
+        // Generic action, usually for tracking menu and toolbar actions.
+        public static final String ACTION = "action.1";
     }
 
     /**
      * Holds event methods. Intended for use in
      * Telemetry.sendUIEvent() as the "method" parameter.
      */
     public interface Method {
         // Action triggered from a list.
@@ -60,16 +63,19 @@ public interface TelemetryContract {
         public static final String BUTTON = "button";
 
         // Action triggered from a dialog.
         public static final String DIALOG = "dialog";
 
         // Action occurred via an intent.
         public static final String INTENT = "intent";
 
+        // Action occurred via the main menu.
+        public static final String MENU = "menu";
+
         // Action occurred via a context menu.
         public static final String CONTEXT_MENU = "contextmenu";
 
         // Action triggered from a view grid item, like a thumbnail.
         public static final String GRID_ITEM = "griditem";
 
         // Action triggered from a view list item, like a row of a list.
         public static final String LIST_ITEM = "listitem";