Bug 1266163 - Replace FENNEC_READER_VIEW_BUTTON histogram with UI telemetry. r=mfinkle,barbara
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Wed, 20 Apr 2016 15:22:46 -0400
changeset 296451 52749e84bf25fb6aed91ab1339b74cc0e7aae5e7
parent 296450 44a989cf6c1662b60e3113cb6503817b7fc31131
child 296452 95f7873a791026df547054351c8a04a427d79a57
push id19116
push usermleibovic@mozilla.com
push dateSat, 07 May 2016 16:34:52 +0000
treeherderfx-team@52749e84bf25 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, barbara
bugs1266163
milestone49.0a1
Bug 1266163 - Replace FENNEC_READER_VIEW_BUTTON histogram with UI telemetry. r=mfinkle,barbara MozReview-Commit-ID: 1guxvXp6loC
mobile/android/chrome/content/Reader.js
toolkit/components/telemetry/Histograms.json
--- a/mobile/android/chrome/content/Reader.js
+++ b/mobile/android/chrome/content/Reader.js
@@ -17,29 +17,16 @@ var Reader = {
   STATUS_FETCH_FAILED_UNSUPPORTED_FORMAT: 3,
   STATUS_FETCHED_ARTICLE: 4,
 
   get _hasUsedToolbar() {
     delete this._hasUsedToolbar;
     return this._hasUsedToolbar = Services.prefs.getBoolPref("reader.has_used_toolbar");
   },
 
-  get _buttonHistogram() {
-    delete this._buttonHistogram;
-    return this._buttonHistogram = Services.telemetry.getHistogramById("FENNEC_READER_VIEW_BUTTON");
-  },
-
-  // Values for "FENNEC_READER_VIEW_BUTTON" histogram.
-  _buttonHistogramValues: {
-    HIDDEN: 0,
-    SHOWN: 1,
-    TAP_ENTER: 2,
-    TAP_EXIT: 3
-  },
-
   /**
    * BackPressListener (listeners / ReaderView Ids).
    */
   _backPressListeners: [],
   _backPressViewIds: [],
 
   /**
    * Set a backPressListener for this tabId / ReaderView Id pair.
@@ -161,19 +148,19 @@ var Reader = {
       }
     }
   },
 
   pageAction: {
     readerModeCallback: function(browser) {
       let url = browser.currentURI.spec;
       if (url.startsWith("about:reader")) {
-        Reader._buttonHistogram.add(Reader._buttonHistogramValues.TAP_EXIT);
+        UITelemetry.addEvent("action.1", "button", "reader_exit");
       } else {
-        Reader._buttonHistogram.add(Reader._buttonHistogramValues.TAP_ENTER);
+        UITelemetry.addEvent("action.1", "button", "reader_enter");
       }
       browser.messageManager.sendAsyncMessage("Reader:ToggleReaderMode");
     },
   },
 
   updatePageAction: function(tab) {
     if (!tab.getActive()) {
       return;
@@ -202,19 +189,19 @@ var Reader = {
       return;
     }
 
     // Only stop a reader session if the foreground viewer is not visible.
     UITelemetry.stopSession("reader.1", "", null);
 
     if (browser.isArticle) {
       showPageAction("drawable://reader", Strings.reader.GetStringFromName("readerView.enter"));
-      this._buttonHistogram.add(this._buttonHistogramValues.SHOWN);
+      UITelemetry.addEvent("show.1", "button", "reader_available");
     } else {
-      this._buttonHistogram.add(this._buttonHistogramValues.HIDDEN);
+      UITelemetry.addEvent("show.1", "button", "reader_unavailable");
     }
   },
 
   /**
    * Gets an article for a given URL. This method will download and parse a document
    * if it does not find the article in the cache.
    *
    * @param url The article URL.
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -9471,23 +9471,16 @@
   },
   "READER_MODE_DOWNLOAD_RESULT" : {
     "expires_in_version": "50",
     "alert_emails": ["mleibovic@mozilla.com"],
     "kind": "enumerated",
     "n_values": 5,
     "description": "The result of trying to download a document to show in reader view (0=Success, 1=Error XHR, 2=Error no document)"
   },
-  "FENNEC_READER_VIEW_BUTTON" : {
-    "expires_in_version": "50",
-    "alert_emails": ["mobile-frontend@mozilla.com"],
-    "kind": "enumerated",
-    "n_values": 10,
-    "description": "Bug 1219240: Measures user interaction with the reader view button (0=Button hidden, 1=Button shown, 2=Tap to enter reader view, 3=Tap to exit reader view, 4=Long tap)"
-  },
   "FENNEC_LOAD_SAVED_PAGE": {
     "expires_in_version": "50",
     "alert_emails": ["mobile-frontend@mozilla.com"],
     "kind": "enumerated",
     "n_values": 10,
     "description": "How often users load saved items when online/offline (0=RL online, 1=RL offline, 2=BM online, 3=BM offline)",
     "bug_numbers": [1243387]
   },