Bug 1330315 - Add a telemetry probe to track how the Preferences are opened, r=mconley
authorFischer.json <fischer.json@gmail.com>
Tue, 09 May 2017 10:43:48 -0400
changeset 406620 471b374af5aba226c603bc9e1bad08b907ab214e
parent 406619 3c20408d22193e9179d9b092b65f5ea9af54deaf
child 406621 b822eb070c1118012bd96e575cfee8abf5354311
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1330315
milestone55.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 1330315 - Add a telemetry probe to track how the Preferences are opened, r=mconley MozReview-Commit-ID: GfuGF4v30pI
browser/base/content/baseMenuOverlay.xul
browser/base/content/browser-data-submission-info-bar.js
browser/base/content/browser-media.js
browser/base/content/browser-menubar.inc
browser/base/content/browser-sets.inc
browser/base/content/browser-sync.js
browser/base/content/browser.js
browser/base/content/utilityOverlay.js
browser/components/customizableui/CustomizableWidgets.jsm
browser/components/newtab/NewTabSearchProvider.jsm
browser/components/nsBrowserContentHandler.js
browser/components/nsBrowserGlue.js
browser/components/search/content/search.xml
browser/components/translation/translation-infobar.xml
browser/components/uitour/UITour.jsm
browser/modules/AboutHome.jsm
browser/modules/ContentSearch.jsm
toolkit/components/telemetry/Histograms.json
toolkit/content/aboutTelemetry.js
toolkit/mozapps/extensions/content/extensions.js
--- a/browser/base/content/baseMenuOverlay.xul
+++ b/browser/base/content/baseMenuOverlay.xul
@@ -17,17 +17,17 @@
 <script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
 
 #ifdef XP_MACOSX
 <!-- nsMenuBarX hides these and uses them to build the Application menu.
      When using Carbon widgets for Mac OS X widgets, some of these are not
      used as they only apply to Cocoa widget builds. All version of Firefox
      through Firefox 2 will use Carbon widgets. -->
     <menupopup id="menu_ToolsPopup">
-        <menuitem id="menu_preferences" label="&preferencesCmdMac.label;" key="key_preferencesCmdMac" oncommand="openPreferences();"/>
+        <menuitem id="menu_preferences" label="&preferencesCmdMac.label;" key="key_preferencesCmdMac" oncommand="openPreferences(undefined, {origin: 'commandLineLegacy'});"/>
         <menuitem id="menu_mac_services" label="&servicesMenuMac.label;"/>
         <menuitem id="menu_mac_hide_app" label="&hideThisAppCmdMac2.label;" key="key_hideThisAppCmdMac"/>
         <menuitem id="menu_mac_hide_others" label="&hideOtherAppsCmdMac.label;" key="key_hideOtherAppsCmdMac"/>
         <menuitem id="menu_mac_show_all" label="&showAllAppsCmdMac.label;"/>
     </menupopup>
 <!-- Mac window menu -->
 #include ../../../toolkit/content/macWindowMenu.inc
 #endif
--- a/browser/base/content/browser-data-submission-info-bar.js
+++ b/browser/base/content/browser-data-submission-info-bar.js
@@ -64,19 +64,19 @@ var gDataNotificationInfoBar = {
       label: gNavigatorBundle.getString("dataReportingNotification.button.label"),
       accessKey: gNavigatorBundle.getString("dataReportingNotification.button.accessKey"),
       popup: null,
       callback: () => {
         this._actionTaken = true;
         // The advanced subpanes are only supported in the old organization, which will
         // be removed by bug 1349689.
         if (Preferences.get("browser.preferences.useOldOrganization", false)) {
-          window.openAdvancedPreferences("dataChoicesTab");
+          window.openAdvancedPreferences("dataChoicesTab", {origin: "dataReporting"});
         } else {
-          window.openPreferences("privacy-reports");
+          window.openPreferences("privacy-reports", {origin: "dataReporting"});
         }
       },
     }];
 
     this._log.info("Creating data reporting policy notification.");
     this._notificationBox.appendNotification(
       message,
       this._DATA_REPORTING_NOTIFICATION,
--- a/browser/base/content/browser-media.js
+++ b/browser/base/content/browser-media.js
@@ -162,17 +162,17 @@ var gEMEHandler = {
       Services.prefs.setBoolPref(firstPlayPref, true);
     } else {
       document.getElementById(anchorId).removeAttribute("firstplay");
     }
 
     let mainAction = {
       label: gNavigatorBundle.getString(btnLabelId),
       accessKey: gNavigatorBundle.getString(btnAccessKeyId),
-      callback() { openPreferences("panePrivacy"); },
+      callback() { openPreferences("panePrivacy", {origin: "browserMedia"}); },
       dismiss: true
     };
     let options = {
       dismissed: true,
       eventCallback: aTopic => aTopic == "swapping",
       learnMoreURL: Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content",
     };
     PopupNotifications.show(browser, "drmContentPlaying", message, anchorId, mainAction, null, options);
--- a/browser/base/content/browser-menubar.inc
+++ b/browser/base/content/browser-menubar.inc
@@ -180,17 +180,17 @@
                           accesskey="&bidiSwitchTextDirectionItem.accesskey;"
                           hidden="true"/>
 #ifdef XP_UNIX
 #ifndef XP_MACOSX
                 <menuseparator/>
                 <menuitem id="menu_preferences"
                           label="&preferencesCmdUnix.label;"
                           accesskey="&preferencesCmdUnix.accesskey;"
-                          oncommand="openPreferences();"/>
+                          oncommand="openPreferences(undefined, {origin: 'menubar'});"/>
 #endif
 #endif
               </menupopup>
             </menu>
 
             <menu id="view-menu" label="&viewMenu.label;"
                   accesskey="&viewMenu.accesskey;">
               <menupopup id="menu_viewPopup"
@@ -527,17 +527,17 @@
                 <menupopup id="menu_mirrorTab-popup"
                            onpopupshowing="populateMirrorTabMenu(this)"/>
               </menu>
 #ifndef XP_UNIX
               <menuseparator id="prefSep"/>
               <menuitem id="menu_preferences"
                         label="&preferencesCmd2.label;"
                         accesskey="&preferencesCmd2.accesskey;"
-                        oncommand="openPreferences();"/>
+                        oncommand="openPreferences(undefined, {origin: 'menubar'});"/>
 #endif
               </menupopup>
             </menu>
 
 #ifdef XP_MACOSX
           <menu id="windowMenu" />
 #endif
           <menu id="helpMenu" />
--- a/browser/base/content/browser-sets.inc
+++ b/browser/base/content/browser-sets.inc
@@ -88,17 +88,17 @@
     <command id="cmd_fullZoomReset"   oncommand="FullZoom.reset()"/>
     <command id="cmd_fullZoomToggle"  oncommand="ZoomManager.toggleZoom();"/>
     <command id="cmd_gestureRotateLeft" oncommand="gGestureSupport.rotate(event.sourceEvent)"/>
     <command id="cmd_gestureRotateRight" oncommand="gGestureSupport.rotate(event.sourceEvent)"/>
     <command id="cmd_gestureRotateEnd" oncommand="gGestureSupport.rotateEnd()"/>
     <command id="Browser:OpenLocation" oncommand="openLocation();"/>
     <command id="Browser:RestoreLastSession" oncommand="restoreLastSession();" disabled="true"/>
     <command id="Browser:NewUserContextTab" oncommand="openNewUserContextTab(event.sourceEvent);"/>
-    <command id="Browser:OpenAboutContainers" oncommand="openPreferences('paneContainers');"/>
+    <command id="Browser:OpenAboutContainers" oncommand="openPreferences('paneContainers', {origin: 'ContainersCommand'});"/>
 
     <command id="Tools:Search" oncommand="BrowserSearch.webSearch();"/>
     <command id="Tools:Downloads" oncommand="BrowserDownloadsUI();"/>
     <command id="Tools:Addons" oncommand="BrowserOpenAddonsMgr();"/>
     <command id="Tools:Sanitize"
      oncommand="Cc['@mozilla.org/browser/browserglue;1'].getService(Ci.nsIBrowserGlue).sanitize(window);"/>
     <command id="Tools:PrivateBrowsing"
       oncommand="OpenBrowserWindow({private: true});"/>
--- a/browser/base/content/browser-sync.js
+++ b/browser/base/content/browser-sync.js
@@ -236,27 +236,27 @@ var gSync = {
     if (state.syncing != syncingUI) { // Do we need to update the UI?
       state.syncing ? this.onActivityStart() : this.onActivityStop();
     }
   },
 
   onMenuPanelCommand() {
     switch (this.panelUIFooter.getAttribute("fxastatus")) {
     case "signedin":
-      this.openPrefs("menupanel");
+      this.openPrefs("menupanel", "fxaSignedin");
       break;
     case "error":
       if (this.panelUIFooter.getAttribute("fxastatus") == "unverified") {
-        this.openPrefs("menupanel");
+        this.openPrefs("menupanel", "fxaError");
       } else {
         this.openSignInAgainPage("menupanel");
       }
       break;
     default:
-      this.openPrefs("menupanel");
+      this.openPrefs("menupanel", "fxa");
       break;
     }
 
     PanelUI.hide();
   },
 
   openAccountsPage(action, urlParams = {}) {
     let params = new URLSearchParams();
@@ -434,18 +434,18 @@ var gSync = {
     }
     const state = UIState.get();
     if (state.status == UIState.STATUS_SIGNED_IN) {
       setTimeout(() => Weave.Service.errorHandler.syncAndReportErrors(), 0);
     }
     Services.obs.notifyObservers(null, "cloudsync:user-sync");
   },
 
-  openPrefs(entryPoint = "syncbutton") {
-    window.openPreferences("paneSync", { urlParams: { entrypoint: entryPoint } });
+  openPrefs(entryPoint = "syncbutton", origin = undefined) {
+    window.openPreferences("paneSync", { origin, urlParams: { entrypoint: entryPoint } });
   },
 
   openSyncedTabsPanel() {
     let placement = CustomizableUI.getPlacementOfWidget("sync-button");
     let area = placement ? placement.area : CustomizableUI.AREA_NAVBAR;
     let anchor = document.getElementById("sync-button") ||
                  document.getElementById("PanelUI-menu-button");
     if (area == CustomizableUI.AREA_PANEL) {
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -522,19 +522,19 @@ const gStoragePressureObserver = {
       buttons.push({
         label: prefStrBundle.getString(prefButtonLabelStringID),
         accessKey: prefStrBundle.getString(prefButtonAccesskeyStringID),
         callback(notificationBar, button) {
           // The advanced subpanes are only supported in the old organization, which will
           // be removed by bug 1349689.
           let win = gBrowser.ownerGlobal;
           if (Preferences.get("browser.preferences.useOldOrganization", false)) {
-            win.openAdvancedPreferences("networkTab");
+            win.openAdvancedPreferences("networkTab", {origin: "storagePressure"});
           } else {
-            win.openPreferences("panePrivacy");
+            win.openPreferences("panePrivacy", {origin: "storagePressure"});
           }
         }
       });
     }
 
     notificationBox.appendNotification(
       msg, "storage-pressure-notification", null, notificationBox.PRIORITY_WARNING_HIGH, buttons, null);
   }
@@ -6358,19 +6358,19 @@ var OfflineApps = {
       });
     }
   },
 
   manage() {
     // The advanced subpanes are only supported in the old organization, which will
     // be removed by bug 1349689.
     if (Preferences.get("browser.preferences.useOldOrganization", false)) {
-      openAdvancedPreferences("networkTab");
+      openAdvancedPreferences("networkTab", {origin: "offlineApps"});
     } else {
-      openPreferences("panePrivacy");
+      openPreferences("panePrivacy", {origin: "offlineApps"});
     }
   },
 
   receiveMessage(msg) {
     switch (msg.name) {
       case "OfflineApps:CheckUsage":
         let uri = makeURI(msg.data.uri);
         if (this._usedMoreThanWarnQuota(uri)) {
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -710,16 +710,22 @@ function openAboutDialog() {
   } else {
     features += "centerscreen,dependent,dialog=no";
   }
 
   window.openDialog("chrome://browser/content/aboutDialog.xul", "", features);
 }
 
 function openPreferences(paneID, extraArgs) {
+  let histogram = Services.telemetry.getHistogramById("FX_PREFERENCES_OPENED_VIA");
+  if (extraArgs && extraArgs.origin) {
+    histogram.add(extraArgs.origin);
+  } else {
+    histogram.add("other");
+  }
   function switchToAdvancedSubPane(doc) {
     if (extraArgs && extraArgs["advancedTab"]) {
       let advancedPaneTabs = doc.getElementById("advancedPrefs");
       advancedPaneTabs.selectedTab = doc.getElementById(extraArgs["advancedTab"]);
     }
   }
 
   // This function is duplicated from preferences.js.
@@ -775,18 +781,18 @@ function openPreferences(paneID, extraAr
   } else {
     if (paneID) {
       browser.contentWindow.gotoPref(paneID);
     }
     switchToAdvancedSubPane(browser.contentDocument);
   }
 }
 
-function openAdvancedPreferences(tabID) {
-  openPreferences("paneAdvanced", { "advancedTab": tabID });
+function openAdvancedPreferences(tabID, origin) {
+  openPreferences("paneAdvanced", { "advancedTab": tabID, origin });
 }
 
 /**
  * Opens the troubleshooting information (about:support) page for this version
  * of the application.
  */
 function openTroubleshootingPage() {
   openUILinkIn("about:support", "tab");
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -1179,17 +1179,17 @@ const CustomizableWidgets = [
     ]),
   }];
 
 let preferencesButton = {
   id: "preferences-button",
   defaultArea: CustomizableUI.AREA_PANEL,
   onCommand(aEvent) {
     let win = aEvent.target.ownerGlobal;
-    win.openPreferences();
+    win.openPreferences(undefined, {origin: "preferencesButton"});
   }
 };
 if (AppConstants.platform == "win") {
   preferencesButton.label = "preferences-button.labelWin";
   preferencesButton.tooltiptext = "preferences-button.tooltipWin2";
 } else if (AppConstants.platform == "macosx") {
   preferencesButton.tooltiptext = "preferences-button.tooltiptext.withshortcut";
   preferencesButton.shortcutId = "key_preferencesCmdMac";
--- a/browser/components/newtab/NewTabSearchProvider.jsm
+++ b/browser/components/newtab/NewTabSearchProvider.jsm
@@ -66,17 +66,17 @@ SearchProvider.prototype = {
   },
 
   removeFormHistory({browser}, suggestion) {
     ContentSearch.removeFormHistoryEntry({target: browser}, suggestion);
   },
 
   manageEngines(browser) {
     const browserWin = browser.ownerGlobal;
-    browserWin.openPreferences("paneGeneral");
+    browserWin.openPreferences("paneGeneral", { origin: "contentSearch" });
   },
 
   async asyncGetState() {
     let state = await ContentSearch.currentStateObj(true);
     return state;
   },
 
   async asyncPerformSearch({browser}, searchData) {
--- a/browser/components/nsBrowserContentHandler.js
+++ b/browser/components/nsBrowserContentHandler.js
@@ -210,17 +210,22 @@ function openWindow(parent, url, target,
   argArray.appendElement(null); // charset
   argArray.appendElement(null); // referer
   argArray.appendElement(null); // postData
   argArray.appendElement(null); // allowThirdPartyFixup
 
   return Services.ww.openWindow(parent, url, target, features, argArray);
 }
 
-function openPreferences() {
+function openPreferences(extraArgs) {
+  if (extraArgs && extraArgs.origin) {
+    Services.telemetry.getHistogramById("FX_PREFERENCES_OPENED_VIA").add(extraArgs.origin);
+  } else {
+    Services.telemetry.getHistogramById("FX_PREFERENCES_OPENED_VIA").add("other");
+  }
   var args = Components.classes["@mozilla.org/array;1"]
                      .createInstance(Components.interfaces.nsIMutableArray);
 
   var wuri = Components.classes["@mozilla.org/supports-string;1"]
                        .createInstance(Components.interfaces.nsISupportsString);
   wuri.data = "about:preferences";
 
   args.appendElement(wuri);
@@ -346,17 +351,17 @@ nsBrowserContentHandler.prototype = {
     }
 
     var chromeParam = cmdLine.handleFlagWithParam("chrome", false);
     if (chromeParam) {
 
       // Handle old preference dialog URLs.
       if (chromeParam == "chrome://browser/content/pref/pref.xul" ||
           chromeParam == "chrome://browser/content/preferences/preferences.xul") {
-        openPreferences();
+        openPreferences({origin: "commandLineLegacy"});
         cmdLine.preventDefault = true;
       } else try {
         let resolvedURI = resolveURIInternal(cmdLine, chromeParam);
         let isLocal = uri => {
           let localSchemes = new Set(["chrome", "file", "resource"]);
           if (uri instanceof Components.interfaces.nsINestedURI) {
             uri = uri.QueryInterface(Components.interfaces.nsINestedURI).innerMostURI;
           }
@@ -371,17 +376,17 @@ nsBrowserContentHandler.prototype = {
           dump("*** Preventing load of web URI as chrome\n");
           dump("    If you're trying to load a webpage, do not pass --chrome.\n");
         }
       } catch (e) {
         Components.utils.reportError(e);
       }
     }
     if (cmdLine.handleFlag("preferences", false)) {
-      openPreferences();
+      openPreferences({origin: "commandLineLegacy"});
       cmdLine.preventDefault = true;
     }
     if (cmdLine.handleFlag("silent", false))
       cmdLine.preventDefault = true;
 
     try {
       var privateWindowParam = cmdLine.handleFlagWithParam("private-window", false);
       if (privateWindowParam) {
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -303,17 +303,17 @@ BrowserGlue.prototype = {
     Cu.import("resource://services-sync/main.js");
     Weave.Service.scheduler.delayedAutoConnect(delay);
   },
 
   // nsIObserver implementation
   observe: function BG_observe(subject, topic, data) {
     switch (topic) {
       case "notifications-open-settings":
-        this._openPreferences("privacy");
+        this._openPreferences("privacy", { origin: "notifOpenSettings" });
         break;
       case "prefservice:after-app-defaults":
         this._onAppDefaults();
         break;
       case "final-ui-startup":
         this._finalUIStartup();
         break;
       case "browser-delayed-startup-finished":
@@ -1705,17 +1705,17 @@ BrowserGlue.prototype = {
     let productName = gBrandBundle.GetStringFromName("brandShortName");
     let title = bundle.GetStringFromName("syncStartNotification.title");
     let body = bundle.formatStringFromName("syncStartNotification.body2",
                                             [productName], 1);
 
     let clickCallback = (subject, topic, data) => {
       if (topic != "alertclickcallback")
         return;
-      this._openPreferences("sync");
+      this._openPreferences("sync", { origin: "doorhanger" });
     }
     AlertsService.showAlertNotification(null, title, body, true, null, clickCallback);
   },
 
   // eslint-disable-next-line complexity
   _migrateUI: function BG__migrateUI() {
     const UI_VERSION = 45;
     const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
@@ -2288,17 +2288,17 @@ BrowserGlue.prototype = {
   _onDeviceDisconnected() {
     let bundle = Services.strings.createBundle("chrome://browser/locale/accounts.properties");
     let title = bundle.GetStringFromName("deviceDisconnectedNotification.title");
     let body = bundle.GetStringFromName("deviceDisconnectedNotification.body");
 
     let clickCallback = (subject, topic, data) => {
       if (topic != "alertclickcallback")
         return;
-      this._openPreferences("sync");
+      this._openPreferences("sync", { origin: "devDisconnectedAlert"});
     }
     AlertsService.showAlertNotification(null, title, body, true, null, clickCallback);
   },
 
   _handleFlashHang() {
     ++this._flashHangCount;
     if (this._flashHangCount < 2) {
       return;
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -1455,17 +1455,17 @@
           // Make sure the engine list is refetched next time it's needed.
           this._engines = null;
         ]]></body>
       </method>
 
       <method name="showSettings">
         <body><![CDATA[
           BrowserUITelemetry.countSearchSettingsEvent(this.telemetryOrigin);
-          openPreferences("general-search");
+          openPreferences("general-search", {origin: "contentSearch"});
           // If the preference tab was already selected, the panel doesn't
           // close itself automatically.
           this.popup.hidePopup();
         ]]></body>
       </method>
 
       <!-- Updates the parts of the UI that show the query string. -->
       <method name="_updateAfterQueryChanged">
--- a/browser/components/translation/translation-infobar.xml
+++ b/browser/components/translation/translation-infobar.xml
@@ -121,17 +121,17 @@
                            onpopupshowing="document.getBindingParent(this).optionsShowing();">
               <xul:menuitem anonid="neverForLanguage"
                             oncommand="document.getBindingParent(this).neverForLanguage();"/>
               <xul:menuitem anonid="neverForSite"
                             oncommand="document.getBindingParent(this).neverForSite();"
                             label="&translation.options.neverForSite.label;"
                             accesskey="&translation.options.neverForSite.accesskey;"/>
               <xul:menuseparator/>
-              <xul:menuitem oncommand="openPreferences('paneGeneral');"
+              <xul:menuitem oncommand="openPreferences('paneGeneral', {origin:'translationInfobar'});"
                             label="&translation.options.preferences.label;"
                             accesskey="&translation.options.preferences.accesskey;"/>
               <xul:menuitem class="subviewbutton panel-subview-footer"
                             oncommand="document.getBindingParent(this).openProviderAttribution();">
                 <xul:deck anonid="translationEngine" selectedIndex="0">
                   <xul:hbox class="translation-attribution">
                     <xul:label>&translation.options.attribution.beforeLogo;</xul:label>
                     <xul:image src="chrome://browser/content/microsoft-translator-attribution.png"
--- a/browser/components/uitour/UITour.jsm
+++ b/browser/components/uitour/UITour.jsm
@@ -531,17 +531,17 @@ this.UITour = {
       }
 
       case "openPreferences": {
         if (typeof data.pane != "string" && typeof data.pane != "undefined") {
           log.warn("openPreferences: Invalid pane specified");
           return false;
         }
 
-        window.openPreferences(data.pane);
+        window.openPreferences(data.pane, { origin: "UITour" });
         break;
       }
 
       case "showFirefoxAccounts": {
         // 'signup' is the only action that makes sense currently, so we don't
         // accept arbitrary actions just to be safe...
         let p = new URLSearchParams("action=signup&entrypoint=uitour");
         // Call our helper to validate extraURLCampaignParams and populate URLSearchParams
--- a/browser/modules/AboutHome.jsm
+++ b/browser/modules/AboutHome.jsm
@@ -133,21 +133,21 @@ var AboutHome = {
         window.PlacesCommandHook.showPlacesOrganizer("History");
         break;
 
       case "AboutHome:Addons":
         window.BrowserOpenAddonsMgr();
         break;
 
       case "AboutHome:Sync":
-        window.openPreferences("paneSync", { urlParams: { entrypoint: "abouthome" } });
+        window.openPreferences("paneSync", { urlParams: { entrypoint: "abouthome" }, origin: "aboutHome"  });
         break;
 
       case "AboutHome:Settings":
-        window.openPreferences();
+        window.openPreferences(undefined, {origin: "aboutHome"} );
         break;
 
       case "AboutHome:RequestUpdate":
         this.sendAboutHomeData(aMessage.target);
         break;
 
       case "AboutHome:MaybeShowAutoMigrationUndoNotification":
         AutoMigrate.maybeShowUndoNotification(aMessage.target);
--- a/browser/modules/ContentSearch.jsm
+++ b/browser/modules/ContentSearch.jsm
@@ -409,17 +409,17 @@ this.ContentSearch = {
   },
 
   _onMessageSetCurrentEngine(msg, data) {
     Services.search.currentEngine = Services.search.getEngineByName(data);
   },
 
   _onMessageManageEngines(msg, data) {
     let browserWin = msg.target.ownerGlobal;
-    browserWin.openPreferences("paneGeneral");
+    browserWin.openPreferences("paneGeneral", {origin: "contentSearch"});
   },
 
   async _onMessageGetSuggestions(msg, data) {
     this._ensureDataHasProperties(data, [
       "engineName",
       "searchString",
     ]);
     let {engineName, searchString} = data;
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -6384,16 +6384,26 @@
     "bug_numbers": [1335907],
     "alert_emails": ["jaws@mozilla.com"],
     "expires_in_version": "59",
     "kind": "categorical",
     "labels": ["unknown", "searchresults", "general", "applications", "privacy", "sync", "advanced"],
     "releaseChannelCollection": "opt-out",
     "description": "Count how often each preference category is opened."
   },
+  "FX_PREFERENCES_OPENED_VIA": {
+    "record_in_processes": ["main", "content"],
+    "bug_numbers": [1330315],
+    "alert_emails": ["jaws@mozilla.com"],
+    "expires_in_version": "59",
+    "kind": "categorical",
+    "labels": ["aboutHome", "aboutTelemetry", "browserMedia", "commandLine", "commandLineLegacy", "ContainersCommand", "contentSearch", "dataReporting", "doorhanger", "devDisconnectedAlert", "experimentsOpenPref", "fxa", "fxaSignedin", "fxaError", "offlineApps", "prefserviceDefaults", "preferencesButton", "paneSync", "storagePressure", "translationInfobar", "UITour", "menubar", "notifOpenSettings", "other"],
+    "releaseChannelCollection": "opt-out",
+    "description":"Count how the Preferences are opened."
+  },
   "INPUT_EVENT_RESPONSE_MS": {
     "record_in_processes": ["main", "content"],
     "alert_emails": ["perf-telemetry-alerts@mozilla.com"],
     "bug_numbers": [1235908],
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 10000,
     "n_buckets": 50,
--- a/toolkit/content/aboutTelemetry.js
+++ b/toolkit/content/aboutTelemetry.js
@@ -240,19 +240,19 @@ var Settings = {
             resource: "preferences_privacy",
           });
         } else {
           // Show the data choices preferences on desktop.
           let mainWindow = getMainWindowWithPreferencesPane();
           // The advanced subpanes are only supported in the old organization, which will
           // be removed by bug 1349689.
           if (Preferences.get("browser.preferences.useOldOrganization", false)) {
-            mainWindow.openAdvancedPreferences("dataChoicesTab");
+            mainWindow.openAdvancedPreferences("dataChoicesTab", {origin: "aboutTelemetry"});
           } else {
-            mainWindow.openPreferences("paneAdvanced");
+            mainWindow.openPreferences("paneAdvanced", {origin: "aboutTelemetry"});
           }
         }
       });
     }
   },
 
   detachObservers() {
     for (let setting of this.SETTINGS) {
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -1547,19 +1547,19 @@ var gViewController = {
       isEnabled() {
         return !!getMainWindowWithPreferencesPane();
       },
       doCommand() {
         let mainWindow = getMainWindowWithPreferencesPane();
         // The advanced subpanes are only supported in the old organization, which will
         // be removed by bug 1349689.
         if (Preferences.get("browser.preferences.useOldOrganization", false)) {
-          mainWindow.openAdvancedPreferences("dataChoicesTab");
+          mainWindow.openAdvancedPreferences("dataChoicesTab", {origin: "experimentsOpenPref"});
         } else {
-          mainWindow.openPreferences("paneAdvanced");
+          mainWindow.openPreferences("paneAdvanced", {origin: "experimentsOpenPref"});
         }
       },
     },
 
     cmd_showUnsignedExtensions: {
       isEnabled() {
         return true;
       },