diff --git a/browser/components/preferences/in-content/main.js b/browser/components/preferences/in-content/main.js index 8d3363fd70dd..b7a12b335ed2 100644 --- a/browser/components/preferences/in-content/main.js +++ b/browser/components/preferences/in-content/main.js @@ -299,6 +299,8 @@ var gMainPane = { gMainPane.checkBrowserContainers); setEventListener("browserContainersSettings", "command", gMainPane.showContainerSettings); + setEventListener("browserHomePage", "input", + gMainPane.onBrowserHomePageChange); // Initializes the fonts dropdowns displayed in this pane. this._rebuildFonts(); @@ -743,8 +745,11 @@ var gMainPane = { } // FIXME Bug 244192: using dangerous "|" joiner! - if (tabs.length) + if (tabs.length) { homePage.value = tabs.map(getTabURI).join("|"); + } + + Services.telemetry.scalarAdd("preferences.use_current_page", 1); }, /** @@ -757,6 +762,23 @@ var gMainPane = { gSubDialog.open("chrome://browser/content/preferences/selectBookmark.xul", "resizable=yes, modal=yes", rv, this._setHomePageToBookmarkClosed.bind(this, rv)); + Services.telemetry.scalarAdd("preferences.use_bookmark", 1); + }, + + onBrowserHomePageChange() { + if (this.telemetryHomePageTimer) { + clearTimeout(this.telemetryHomePageTimer); + } + let browserHomePage = document.querySelector("#browserHomePage").value; + // The length of the home page URL string should be more then four, + // and it should contain at least one ".", for example, "https://mozilla.org". + if (browserHomePage.length > 4 && browserHomePage.includes(".")) { + this.telemetryHomePageTimer = setTimeout(() => { + let homePageNumber = browserHomePage.split("|").length; + Services.telemetry.scalarAdd("preferences.browser_home_page_change", 1); + Services.telemetry.keyedScalarAdd("preferences.browser_home_page_count", homePageNumber, 1); + }, 3000); + } }, _setHomePageToBookmarkClosed(rv, aEvent) { diff --git a/toolkit/components/telemetry/Scalars.yaml b/toolkit/components/telemetry/Scalars.yaml index 6ca1c1adcfed..a6ea7ebeb5d1 100644 --- a/toolkit/components/telemetry/Scalars.yaml +++ b/toolkit/components/telemetry/Scalars.yaml @@ -545,6 +545,64 @@ preferences: release_channel_collection: opt-in record_in_processes: - main + browser_home_page_change: + bug_numbers: + - 1392951 + description: >- + The number of times the home page has been changed. + Recorded when a user changes his/her home page successfully. + expires: "62" + kind: uint + keyed: true + notification_emails: + - chsiang@mozilla.com + release_channel_collection: opt-out + record_in_processes: + - main + browser_home_page_count: + bug_numbers: + - 1392951 + description: >- + Each key is the number of home page urls when users change their home page, + multiple home pages can be set (delineated with a "|"), + and each value is the number of times that key is recorded. + The telemetry data will be recorded if a user changes his/her home page successfully. + expires: "62" + kind: uint + keyed: true + notification_emails: + - chsiang@mozilla.com + release_channel_collection: opt-out + record_in_processes: + - main + use_current_page: + bug_numbers: + - 1392951 + description: >- + The number of times the Use Current Page button has been clicked. + Recorded when a a user clicks the "Use Current Page" button. + expires: "62" + kind: uint + keyed: true + notification_emails: + - chsiang@mozilla.com + release_channel_collection: opt-out + record_in_processes: + - main + use_bookmark: + bug_numbers: + - 1392951 + description: >- + The number of times the "Use Bookmark..." button has been clicked. + Recorded when a a user clicks the "Use Bookmark..." button. + expires: "62" + kind: uint + keyed: true + notification_emails: + - chsiang@mozilla.com + release_channel_collection: opt-out + record_in_processes: + - main # The following section contains WebRTC nICEr scalars # For more info on ICE, see https://tools.ietf.org/html/rfc5245