Bug 1392951 - Implement telemetry probe for home page setup. r=liuche,mconley

- Send a ping when user type in "Home page" box.
  - String is longer than 4 letters and with at least one ".".
  - String is not deleted after 3 seconds.
- Send a ping when "Use Current Page" is clicked.
- Send a ping when "Use Bookmark" is clicked.
- Send the number of "|" is detected in "Home page" box.

MozReview-Commit-ID: 6bYK0eCkYym

--HG--
extra : rebase_source : 8ead54eff6e34fb8cc33d8a0a9d463902ed534e7
This commit is contained in:
Evan Tseng 2017-10-06 16:13:05 +08:00
Родитель 925214d9af
Коммит 03ab88c492
2 изменённых файлов: 81 добавлений и 1 удалений

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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