Bug 1465698 - Add readermode event probes for Savant Shield study; r=jaws, a=RyanVM
authorBianca Danforth <bdanforth@mozilla.com>
Wed, 06 Jun 2018 03:56:32 -0700
changeset 473708 5a59ca5aacd6ac555a6bbe4acee3ca4fc4a028d7
parent 473707 e5af051da7e6a27a23f0dd9abda006b6329e332e
child 473709 f28277267cb28415ae71b3a75f52c1a27d148183
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, RyanVM
bugs1465698
milestone61.0
Bug 1465698 - Add readermode event probes for Savant Shield study; r=jaws, a=RyanVM 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]