Bug 1573837 - Add utm_* params to the "View full report on Firefox Monitor" link. r=johannh
authorMicah Tigley <mtigley@mozilla.com>
Thu, 15 Aug 2019 22:57:09 +0000
changeset 488371 698f0817d19dc636e46a17c66a3183199b07ef63
parent 488370 77c8de59e66a2f416cfb3f5254f6c3f6c8e0d246
child 488372 691f28f0517fd094c983038165cd6fb6683bc852
push id113906
push userncsoregi@mozilla.com
push dateFri, 16 Aug 2019 04:07:24 +0000
treeherdermozilla-inbound@d887276421d3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1573837
milestone70.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 1573837 - Add utm_* params to the "View full report on Firefox Monitor" link. r=johannh Differential Revision: https://phabricator.services.mozilla.com/D42144
browser/app/profile/firefox.js
browser/components/protections/content/monitor-card.js
browser/components/protections/test/browser/browser_protections_telemetry.js
toolkit/components/remotepagemanager/MessagePort.jsm
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1611,17 +1611,18 @@ pref("browser.contentblocking.customBloc
 pref("browser.contentblocking.reportBreakage.url", "https://tracking-protection-issues.herokuapp.com/new");
 
 // Enable Protections report's Lockwise card by default.
 pref("browser.contentblocking.report.lockwise.enabled", true);
 
 // Enable Protections report's Monitor card by default.
 pref("browser.contentblocking.report.monitor.enabled", true);
 
-pref("browser.contentblocking.report.monitor.url", "https://monitor.firefox.com");
+pref("browser.contentblocking.report.monitor.url", "https://monitor.firefox.com/?entrypoint=protection_report_monitor&utm_source=about-protections");
+pref("browser.contentblocking.report.monitor.sign_in_url", "https://monitor.firefox.com/oauth/init?entrypoint=protection_report_monitor&utm_source=about-protections&email=");
 pref("browser.contentblocking.report.lockwise.url", "https://lockwise.firefox.com/");
 pref("browser.contentblocking.report.manage_devices.url", "https://accounts.firefox.com/settings/clients");
 
 // Protection Report's SUMO urls
 pref("browser.contentblocking.report.monitor.how_it_works.url", "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/monitor-faq");
 pref("browser.contentblocking.report.lockwise.how_it_works.url", "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/password-manager-report");
 pref("browser.contentblocking.report.social.url", "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/social-media-tracking-report");
 pref("browser.contentblocking.report.cookie.url", "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/cross-site-tracking-report");
--- a/browser/components/protections/content/monitor-card.js
+++ b/browser/components/protections/content/monitor-card.js
@@ -1,30 +1,34 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* eslint-env mozilla/frame-script */
 
+const MONITOR_URL = RPMGetStringPref(
+  "browser.contentblocking.report.monitor.url",
+  ""
+);
 const MONITOR_SIGN_IN_URL = RPMGetStringPref(
-  "browser.contentblocking.report.monitor.url",
+  "browser.contentblocking.report.monitor.sign_in_url",
   ""
 );
 const HOW_IT_WORKS_URL_PREF = RPMGetFormatURLPref(
   "browser.contentblocking.report.monitor.how_it_works.url"
 );
 
 export default class MonitorClass {
   constructor(document) {
     this.doc = document;
   }
 
   init() {
     const monitorLinkTag = this.doc.getElementById("monitor-inline-link");
-    monitorLinkTag.href = MONITOR_SIGN_IN_URL;
+    monitorLinkTag.href = MONITOR_URL;
 
     RPMAddMessageListener("SendUserLoginsData", ({ data }) => {
       // Wait for monitor data and display the card.
       this.getMonitorData(data);
       RPMSendAsyncMessage("FetchMonitorData");
     });
 
     let monitorReportLink = this.doc.getElementById("full-report-link");
@@ -94,26 +98,17 @@ export default class MonitorClass {
    *
    * @param {String|null} email
    *        Optional. The email used to direct the user to the Monitor website's OAuth
    *        sign-in flow. If null, then direct user to just the Monitor website.
    *
    * @return URL to Monitor website.
    */
   buildMonitorUrl(email = null) {
-    let url = MONITOR_SIGN_IN_URL;
-
-    if (email) {
-      url += `/oauth/init?email=${email}&entrypoint=protection_report_monitor&utm_source=about-protections`;
-    } else {
-      url +=
-        "/?entrypoint=protection_report_monitor&utm_source=about-protections";
-    }
-
-    return url;
+    return email ? `${MONITOR_SIGN_IN_URL}${email}` : MONITOR_URL;
   }
 
   renderContentForUserWithLogins(monitorData) {
     const monitorCardBody = this.doc.querySelector(
       ".card.monitor-card .card-body"
     );
     monitorCardBody.classList.remove("hidden");
 
--- a/browser/components/protections/test/browser/browser_protections_telemetry.js
+++ b/browser/components/protections/test/browser/browser_protections_telemetry.js
@@ -9,16 +9,17 @@ add_task(async function setup() {
   await SpecialPowers.pushPrefEnv({
     set: [
       ["browser.contentblocking.database.enabled", true],
       ["browser.contentblocking.report.monitor.enabled", true],
       ["browser.contentblocking.report.lockwise.enabled", true],
       ["browser.contentblocking.report.proxy.enabled", true],
       // Change the endpoints to prevent non-local network connections when landing on the page.
       ["browser.contentblocking.report.monitor.url", ""],
+      ["browser.contentblocking.report.monitor.sign_in_url", ""],
       ["browser.contentblocking.report.lockwise.url", ""],
     ],
   });
 
   let oldCanRecord = Services.telemetry.canRecordExtended;
   Services.telemetry.canRecordExtended = true;
   registerCleanupFunction(() => {
     Services.telemetry.canRecordExtended = oldCanRecord;
--- a/toolkit/components/remotepagemanager/MessagePort.jsm
+++ b/toolkit/components/remotepagemanager/MessagePort.jsm
@@ -62,16 +62,17 @@ let RPMAccessManager = {
         "browser.contentblocking.report.lockwise.enabled",
         "browser.contentblocking.report.monitor.enabled",
         "privacy.socialtracking.block_cookies.enabled",
       ],
       getStringPref: [
         "browser.contentblocking.category",
         "browser.contentblocking.report.lockwise.url",
         "browser.contentblocking.report.monitor.url",
+        "browser.contentblocking.report.monitor.sign_in_url",
         "browser.contentblocking.report.manage_devices.url",
       ],
       getFormatURLPref: [
         "browser.contentblocking.report.monitor.how_it_works.url",
         "browser.contentblocking.report.lockwise.how_it_works.url",
         "browser.contentblocking.report.social.url",
         "browser.contentblocking.report.cookie.url",
         "browser.contentblocking.report.tracker.url",