Bug 1219240 - Telemetry probe to measure user interaction with reader view button. r=mfinkle,vladan, a=ritu
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Wed, 28 Oct 2015 17:07:24 -0400
changeset 291464 a47427a35e8c7172d06a38b8cada675a4504a3b5
parent 291463 2e487524d648330c324741d879197fc6ce841195
child 291465 d6e5df20ab6195aee11a8928e81e532026a676d6
push id8704
push usercbook@mozilla.com
push dateTue, 10 Nov 2015 15:56:53 +0000
treeherdermozilla-aurora@d6e5df20ab61 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, vladan, ritu
bugs1219240
milestone44.0a2
Bug 1219240 - Telemetry probe to measure user interaction with reader view button. r=mfinkle,vladan, a=ritu
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
@@ -15,16 +15,30 @@ 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,
+    LONG_TAP: 4
+  },
+
   /**
    * BackPressListener (listeners / ReaderView Ids).
    */
   _backPressListeners: [],
   _backPressViewIds: [],
 
   /**
    * Set a backPressListener for this tabId / ReaderView Id pair.
@@ -197,24 +211,27 @@ var Reader = {
       let url = browser.currentURI.spec;
       if (url.startsWith("about:reader")) {
         let originalURL = ReaderMode.getOriginalUrl(url);
         if (!originalURL) {
           Cu.reportError("Error finding original URL for about:reader URL: " + url);
         } else {
           browser.loadURI(originalURL);
         }
+        Reader._buttonHistogram.add(Reader._buttonHistogramValues.TAP_EXIT);
       } else {
         browser.messageManager.sendAsyncMessage("Reader:ParseDocument", { url: url });
+        Reader._buttonHistogram.add(Reader._buttonHistogramValues.TAP_ENTER);
       }
     },
 
     readerModeActiveCallback: function(tabID) {
       Reader._addTabToReadingList(tabID).catch(e => Cu.reportError("Error adding tab to reading list: " + e));
       UITelemetry.addEvent("save.1", "pageaction", null, "reader");
+      Reader._buttonHistogram.add(Reader._buttonHistogramValues.LONG_TAP);
     },
   },
 
   updatePageAction: function(tab) {
     if (!tab.getActive()) {
       return;
     }
 
@@ -242,16 +259,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);
+    } else {
+      this._buttonHistogram.add(this._buttonHistogramValues.HIDDEN);
     }
   },
 
   /**
    * Downloads and caches content for a reading list item with a given URL and id.
    */
   _fetchContent: function(url, id) {
     this._downloadAndCacheArticle(url).then(article => {
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -9037,48 +9037,60 @@
     "alert_emails": ["gfx-telemetry-alerts@mozilla.com"],
     "kind": "enumerated",
     "n_values": 20,
     "releaseChannelCollection": "opt-out",
     "description": "Reports results from the graphics sanity test to track which drivers are having problems (0=TEST_PASSED, 1=TEST_FAILED_RENDER, 2=TEST_FAILED_VIDEO, 3=TEST_CRASHED)"
   },
   "READER_MODE_SERIALIZE_DOM_MS": {
     "expires_in_version": "50",
+    "alert_emails": ["mleibovic@mozilla.com"],
     "kind": "exponential",
     "high": "5000",
     "n_buckets": 15,
     "description": "Time (ms) to serialize a DOM to send to the reader worker"
   },
   "READER_MODE_WORKER_PARSE_MS": {
     "expires_in_version": "50",
+    "alert_emails": ["mleibovic@mozilla.com"],
     "kind": "exponential",
     "high": "10000",
     "n_buckets": 30,
     "description": "Time (ms) for the reader worker to parse a document"
   },
   "READER_MODE_DOWNLOAD_MS": {
     "expires_in_version": "50",
+    "alert_emails": ["mleibovic@mozilla.com"],
     "kind": "exponential",
     "low": 50,
     "high": "40000",
     "n_buckets": 60,
     "description": "Time (ms) to download a document to show in reader mode"
   },
   "READER_MODE_PARSE_RESULT" : {
     "expires_in_version": "50",
+    "alert_emails": ["mleibovic@mozilla.com"],
     "kind": "enumerated",
     "n_values": 5,
     "description": "The result of trying to parse a document to show in reader view (0=Success, 1=Error too many elements, 2=Error in worker, 3=Error no article)"
   },
   "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": ["mleibovic@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)"
+  },
   "PERMISSIONS_SQL_CORRUPTED": {
     "expires_in_version": "never",
     "kind": "count",
     "description": "Record the permissions.sqlite init failure"
   },
   "DEFECTIVE_PERMISSIONS_SQL_REMOVED": {
     "expires_in_version": "never",
     "kind": "count",