Bug 1585808 - Add UTM parameters to the "Learn more about this breach" link in breach notifications. r=MattN, a=lizzard
authormcrawford@mozilla.com <mcrawford@mozilla.com>
Wed, 09 Oct 2019 20:18:54 +0000
changeset 552367 01fd845cda3ff35e3efc685c9601107989d90eea
parent 552366 ff97b7b66c717dfaa02d0991a141f81e3572e87c
child 552368 2ce58a99cbfdbebff2ff4c878accfffcd1170bd2
push id12155
push userjcristau@mozilla.com
push dateThu, 10 Oct 2019 14:13:03 +0000
treeherdermozilla-beta@2ce58a99cbfd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN, lizzard
bugs1585808
milestone70.0
Bug 1585808 - Add UTM parameters to the "Learn more about this breach" link in breach notifications. r=MattN, a=lizzard Differential Revision: https://phabricator.services.mozilla.com/D48597
browser/components/aboutlogins/LoginBreaches.jsm
browser/components/aboutlogins/tests/unit/test_getPotentialBreachesByLoginGUID.js
--- a/browser/components/aboutlogins/LoginBreaches.jsm
+++ b/browser/components/aboutlogins/LoginBreaches.jsm
@@ -111,16 +111,20 @@ this.LoginBreaches = {
             breach,
             dismissedBreachAlertsByLoginGUID
           )
         ) {
           continue;
         }
 
         let breachAlertURL = new URL(breach.Name, baseBreachAlertURL);
+        breachAlertURL.searchParams.set("utm_source", "firefox-desktop");
+        breachAlertURL.searchParams.set("utm_medium", "referral");
+        breachAlertURL.searchParams.set("utm_campaign", "about-logins");
+        breachAlertURL.searchParams.set("utm_content", "about-logins");
         breach.breachAlertURL = breachAlertURL.href;
         breachesByLoginGUID.set(login.guid, breach);
       }
     }
     Services.telemetry.scalarSet(
       "pwmgr.potentially_breached_passwords",
       breachesByLoginGUID.size
     );
--- a/browser/components/aboutlogins/tests/unit/test_getPotentialBreachesByLoginGUID.js
+++ b/browser/components/aboutlogins/tests/unit/test_getPotentialBreachesByLoginGUID.js
@@ -116,26 +116,30 @@ add_task(async function test_notBreached
     breachesByLoginGUID.size,
     0,
     "Should be 0 breached logins."
   );
 });
 
 add_task(async function test_breachedLogin() {
   Services.logins.addLogin(BREACHED_LOGIN);
-
   const breachesByLoginGUID = await LoginBreaches.getPotentialBreachesByLoginGUID(
     [NOT_BREACHED_LOGIN, BREACHED_LOGIN],
     TEST_BREACHES
   );
   Assert.strictEqual(
     breachesByLoginGUID.size,
     1,
     "Should be 1 breached login: " + BREACHED_LOGIN.origin
   );
+  Assert.strictEqual(
+    breachesByLoginGUID.get(BREACHED_LOGIN.guid).breachAlertURL,
+    "https://monitor.firefox.com/breach-details/Breached?utm_source=firefox-desktop&utm_medium=referral&utm_campaign=about-logins&utm_content=about-logins",
+    "Breach alert link should be equal to the breachAlertURL"
+  );
 });
 
 add_task(async function test_notBreachedSubdomain() {
   Services.logins.addLogin(NOT_BREACHED_SUBDOMAIN_LOGIN);
 
   const breachesByLoginGUID = await LoginBreaches.getPotentialBreachesByLoginGUID(
     [NOT_BREACHED_LOGIN, NOT_BREACHED_SUBDOMAIN_LOGIN],
     TEST_BREACHES