Bug 1465698 - Add readermode event probes for Savant Shield study; r=jaws draft
authorBianca Danforth <bdanforth@mozilla.com>
Wed, 06 Jun 2018 03:56:32 -0700
changeset 804994 2474bdf3e10e960ab5264804dbf693c5bd3b6ac1
parent 804634 cec4a3cecc29ff97860198969b6fdff24b9e93bb
push id112513
push userbdanforth@mozilla.com
push dateWed, 06 Jun 2018 21:23:06 +0000
reviewersjaws
bugs1465698
milestone62.0a1
Bug 1465698 - Add readermode event probes for Savant Shield study; r=jaws These probes will register and record (for the duration of the study only): * When the user turns on Reader Mode. * When the user turns off Reader Mode. Note: The events are recorded in the content process. MozReview-Commit-ID: BNEYW3TP1aN
toolkit/components/reader/ReaderMode.jsm
toolkit/components/telemetry/Events.yaml
--- a/toolkit/components/reader/ReaderMode.jsm
+++ b/toolkit/components/reader/ReaderMode.jsm
@@ -91,16 +91,19 @@ var ReaderMode = {
     }
   },
 
   /**
    * Enter the reader mode by going forward one step in history if applicable,
    * if not, append the about:reader page in the history instead.
    */
   enterReaderMode(docShell, win) {
+    Services.telemetry.recordEvent("savant", "readermode", "on", null,
+                                  { subcategory: "feature" });
+
     let url = win.document.location.href;
     let readerURL = "about:reader?url=" + encodeURIComponent(url);
     let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
     let sh = webNav.sessionHistory;
     if (webNav.canGoForward) {
       let forwardEntry = sh.legacySHistory.getEntryAtIndex(sh.index + 1, false);
       let forwardURL = forwardEntry.URI.spec;
       if (forwardURL && (forwardURL == readerURL || !readerURL)) {
@@ -112,16 +115,18 @@ var ReaderMode = {
     win.document.location = readerURL;
   },
 
   /**
    * Exit the reader mode by going back one step in history if applicable,
    * if not, append the original page in the history instead.
    */
   leaveReaderMode(docShell, win) {
+    Services.telemetry.recordEvent("savant", "readermode", "off", null,
+                                  { subcategory: "feature" });
     let url = win.document.location.href;
     let originalURL = this.getOriginalUrl(url);
     let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
     let sh = webNav.sessionHistory;
     if (webNav.canGoBack) {
       let prevEntry = sh.legacySHistory.getEntryAtIndex(sh.index - 1, false);
       let prevURL = prevEntry.URI.spec;
       if (prevURL && (prevURL == originalURL || !originalURL)) {
--- a/toolkit/components/telemetry/Events.yaml
+++ b/toolkit/components/telemetry/Events.yaml
@@ -115,16 +115,29 @@ savant:
       Shield study. The object field records the reason that caused the ending.
     bug_numbers: [1457226, 1462725]
     notification_emails:
       - "bdanforth@mozilla.com"
       - "shong@mozilla.com"
     expiry_version: "65"
     extra_keys:
       subcategory: The broad event category for this probe. E.g. navigation
+  readermode:
+    objects: ["on", "off"]
+    release_channel_collection: opt-out
+    record_in_processes: ["content"]
+    description: >
+      This is recorded any time Reader Mode is turned on or off.
+    bug_numbers: [1457226, 1465698]
+    notification_emails:
+      - "bdanforth@mozilla.com"
+      - "shong@mozilla.com"
+    expiry_version: "65"
+    extra_keys:
+      subcategory: The broad event category for this probe. E.g. navigation
 
 # This category contains event entries used for Telemetry tests.
 # They will not be sent out with any pings.
 telemetry.test:
   test:
     methods: ["test1", "test2"]
     objects: ["object1", "object2"]
     bug_numbers: [1286606]