Bug 1038248 - Add UITelemetry to count the number and type of searches. r=mconley

This commit is contained in:
Blake Winton 2014-07-17 11:37:22 -04:00
Родитель a29afdebde
Коммит dc4882b221
3 изменённых файлов: 14 добавлений и 2 удалений

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

@ -11,6 +11,8 @@ Cu.import("resource://gre/modules/NotificationDB.jsm");
Cu.import("resource:///modules/RecentWindow.jsm");
Cu.import("resource://gre/modules/WindowsPrefSync.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "BrowserUITelemetry",
"resource:///modules/BrowserUITelemetry.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
"resource://gre/modules/BrowserUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
@ -3095,6 +3097,7 @@ const BrowserSearch = {
* SearchesProvider for allowed values.
*/
recordSearchInHealthReport: function (engine, source) {
BrowserUITelemetry.countSearchEvent(source);
#ifdef MOZ_SERVICES_HEALTHREPORT
let reporter = Cc["@mozilla.org/datareporting/service;1"]
.getService()

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

@ -321,12 +321,14 @@ BrowserGlue.prototype = {
// the UI has gone should be finalized in _onQuitApplicationGranted.
this._dispose();
break;
#ifdef MOZ_SERVICES_HEALTHREPORT
case "keyword-search":
// This is very similar to code in
// browser.js:BrowserSearch.recordSearchInHealthReport(). The code could
// be consolidated if there is will. We need the observer in
// nsBrowserGlue to prevent double counting.
let win = this.getMostRecentBrowserWindow();
BrowserUITelemetry.countSearchEvent("urlbar", win.gURLBar.value);
#ifdef MOZ_SERVICES_HEALTHREPORT
let reporter = Cc["@mozilla.org/datareporting/service;1"]
.getService()
.wrappedJSObject
@ -344,8 +346,8 @@ BrowserGlue.prototype = {
Cu.reportError(ex);
}
});
break;
#endif
break;
case "browser-search-engine-modified":
if (data != "engine-default" && data != "engine-current") {
break;

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

@ -551,6 +551,13 @@ this.BrowserUITelemetry = {
this._countEvent(["customize", aEventType]);
},
countSearchEvent: function(source, query) {
this._countEvent(["search", source]);
if ((/^[a-zA-Z]+:[^\/\\]/).test(query)) {
this._countEvent(["search", "urlbar-keyword"]);
}
},
_durations: {
customization: [],
},