Bug 1183234 - Telemetry probe for usage of about:logins UI interactions.r,p=vladan
authorAllison Naaktgeboren <ally@mozilla.com>
Thu, 30 Jul 2015 13:36:51 -0700
changeset 287166 3e37f8f832995c9a28691b3f003bc5eccfa4b5dc
parent 287165 acc4a2918f31e0e1433f8b5df13074e381ffb13e
child 287167 a25357fa76f9fd637c9cb521b3fcff36c2f969b1
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1183234
milestone42.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 1183234 - Telemetry probe for usage of about:logins UI interactions.r,p=vladan
mobile/android/chrome/content/aboutLogins.js
toolkit/components/telemetry/Histograms.json
--- a/mobile/android/chrome/content/aboutLogins.js
+++ b/mobile/android/chrome/content/aboutLogins.js
@@ -33,16 +33,21 @@ function copyStringAndToast(string, noti
   } catch (e) {
     debug("Error copying from about:logins");
     gChromeWin.NativeWindow.toast.show(gStringBundle.GetStringFromName("loginsDetails.copyFailed"), "short");
   }
 }
 
 // Delay filtering while typing in MS
 const FILTER_DELAY = 500;
+/* Constants for usage telemetry */
+const LOGINS_LIST_VIEWED = 0;
+const LOGIN_VIEWED = 1;
+const LOGIN_EDITED = 2;
+const LOGIN_PW_TOGGLED = 3;
 
 let Logins = {
   _logins: [],
   _filterTimer: null,
   _selectedLogin: null,
 
   _getLogins: function() {
     let logins;
@@ -157,16 +162,17 @@ let Logins = {
       let item = this._createItemForLogin(login);
       newList.appendChild(item);
     });
 
     list.parentNode.replaceChild(newList, list);
   },
 
   _showList: function () {
+    Services.telemetry.getHistogramById("PWMGR_ABOUT_LOGINS_USAGE").add(LOGINS_LIST_VIEWED);
     let loginsListPage = document.getElementById("logins-list-page");
     loginsListPage.classList.remove("hidden");
 
     let editLoginPage = document.getElementById("edit-login-page");
     editLoginPage.classList.add("hidden");
 
     // If the Show/Hide password button has been flipped, reset it
     if (this._isPasswordBtnInHideMode()) {
@@ -179,16 +185,17 @@ let Logins = {
     if (event.state) {
       this._showEditLoginDialog(event.state.id);
     } else {
       this._selectedLogin = null;
       this._showList();
     }
   },
   _showEditLoginDialog: function (login) {
+    Services.telemetry.getHistogramById("PWMGR_ABOUT_LOGINS_USAGE").add(LOGIN_VIEWED);
     let listPage = document.getElementById("logins-list-page");
     listPage.classList.add("hidden");
 
     let editLoginPage = document.getElementById("edit-login-page");
     editLoginPage.classList.remove("hidden");
 
     let usernameField = document.getElementById("username");
     usernameField.value = login.username;
@@ -205,16 +212,17 @@ let Logins = {
       headerText.textContent = login.hostname;
     }
     else {
       headerText.textContent = gStringBundle.GetStringFromName("editLogin.fallbackTitle");
     }
   },
 
   _onSaveEditLogin: function() {
+    Services.telemetry.getHistogramById("PWMGR_ABOUT_LOGINS_USAGE").add(LOGIN_EDITED);
     let newUsername = document.getElementById("username").value;
     let newPassword = document.getElementById("password").value;
     let newDomain  = document.getElementById("hostname").value;
     let origUsername = this._selectedLogin.username;
     let origPassword = this._selectedLogin.password;
     let origDomain = this._selectedLogin.hostname;
 
     try {
@@ -243,16 +251,17 @@ let Logins = {
       gChromeWin.NativeWindow.toast.show(gStringBundle.GetStringFromName("editLogin.couldNotSave"), "short");
       return;
     }
     gChromeWin.NativeWindow.toast.show(gStringBundle.GetStringFromName("editLogin.saved1"), "short");
     this._showList();
   },
 
   _onPasswordBtn: function () {
+    Services.telemetry.getHistogramById("PWMGR_ABOUT_LOGINS_USAGE").add(LOGIN_PW_TOGGLED);
     this._updatePasswordBtn(this._isPasswordBtnInHideMode());
   },
 
   _updatePasswordBtn: function (aShouldShow) {
     let passwordField = document.getElementById("password");
     let button = document.getElementById("password-btn");
     let show = gStringBundle.GetStringFromName("password-btn.show");
     let hide = gStringBundle.GetStringFromName("password-btn.hide");
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -8226,16 +8226,22 @@
   "PWMGR_ABOUT_LOGINS_GET_ALL_LOGINS_MS": {
     "expires_in_version": "55",
     "kind": "exponential",
     "high": 60000,
     "n_buckets": 30,
     "extended_statistics_ok": true,
     "description": "How long getAllLogins() on about:logins takes for mobile users"
   },
+  "PWMGR_ABOUT_LOGINS_USAGE": {
+    "expires_in_version": "55",
+    "kind": "enumerated",
+    "n_values": 12,
+    "description": "Usage of about:logins 0= list of logins viewed, 1=a login's specifics page was viewed, 2=user edited login credentials 3=user toggled the show/hide button"
+  },
   "PWMGR_BLOCKLIST_NUM_SITES": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 100,
     "n_buckets" : 10,
     "extended_statistics_ok": true,
     "description": "The number of sites for which the user has explicitly rejected saving logins"
   },