Bug 914481 - Patch 1 - Push usage and permissions telemetry. r=kitcambridge

--HG--
extra : commitid : FcrPQqWE4k8
extra : rebase_source : 3c39e7c98557163c93cb8bf5e4fe4f0a9ba5376b
This commit is contained in:
Nikhil Marathe 2015-08-05 15:12:11 -07:00
parent 8108bffcc3
commit dee87894d8
2 changed files with 32 additions and 0 deletions

View File

@ -98,14 +98,20 @@ Push.prototype = {
principal: principal,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionRequest]),
allow: function() {
let histogram = Services.telemetry.getHistogramById("PUSH_API_PERMISSION_GRANTED");
histogram.add();
aAllowCallback();
},
cancel: function() {
let histogram = Services.telemetry.getHistogramById("PUSH_API_PERMISSION_DENIED");
histogram.add();
aCancelCallback();
},
window: this._window
};
let histogram = Services.telemetry.getHistogramById("PUSH_API_PERMISSION_REQUESTED");
histogram.add(1);
// Using askPermission from nsIDOMWindowUtils that takes care of the
// remoting if needed.
let windowUtils = this._window.QueryInterface(Ci.nsIInterfaceRequestor)
@ -159,6 +165,8 @@ Push.prototype = {
subscribe: function() {
debug("subscribe()");
let histogram = Services.telemetry.getHistogramById("PUSH_API_USED");
histogram.add(true);
return this.getEndpointResponse(this._client.subscribe.bind(this._client));
},

View File

@ -9477,5 +9477,29 @@
"expires_in_version": "never",
"kind": "count",
"description": "Number of top-level content documents destroyed; used in conjunction with use counter histograms"
},
"PUSH_API_USED": {
"alert_emails": ["push@mozilla.com"],
"expires_in_version": "55",
"kind": "flag",
"description": "A Push API subscribe() operation was performed at least once this session."
},
"PUSH_API_PERMISSION_REQUESTED": {
"alert_emails": ["push@mozilla.com"],
"expires_in_version": "55",
"kind": "count",
"description": "Count of number of times the PermissionManager explicitly prompted user for Push Notifications permission"
},
"PUSH_API_PERMISSION_DENIED": {
"alert_emails": ["push@mozilla.com"],
"expires_in_version": "55",
"kind": "count",
"description": "User explicitly denied Push Notifications permission"
},
"PUSH_API_PERMISSION_GRANTED": {
"alert_emails": ["push@mozilla.com"],
"expires_in_version": "55",
"kind": "count",
"description": "User explicitly granted Push Notifications permission"
}
}