Bug 1058133: Telemetry for tracking protection events (r=bmcbride)

This commit is contained in:
Monica Chew 2014-08-28 09:29:14 -07:00
parent 4ec7a6d23d
commit 97dbc43821
3 changed files with 48 additions and 0 deletions

View File

@ -1279,6 +1279,12 @@ var gBrowserInit = {
Services.telemetry.getHistogramById("MASTER_PASSWORD_ENABLED").add(mpEnabled);
}
}, 5000);
// Telemetry for tracking protection.
let tpEnabled = gPrefService
.getBoolPref("privacy.trackingprotection.enabled");
Services.telemetry.getHistogramById("TRACKING_PROTECTION_ENABLED")
.add(tpEnabled);
});
this.delayedStartupFinished = true;
@ -6496,6 +6502,10 @@ var gIdentityHandler = {
nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT |
nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT)) {
this.showBadContentDoorhanger(state);
} else {
// We didn't show the shield
Services.telemetry.getHistogramById("TRACKING_PROTECTION_SHIELD")
.add(0);
}
},
@ -6517,6 +6527,19 @@ var gIdentityHandler = {
// default
let iconState = "bad-content-blocked-notification-icon";
// Telemetry for whether the shield was due to tracking protection or not
let histogram = Services.telemetry.getHistogramById
("TRACKING_PROTECTION_SHIELD");
if (state & Ci.nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT) {
histogram.add(1);
} else if (state &
Ci.nsIWebProgressListener.STATE_BLOCKED_TRACKING_CONTENT) {
histogram.add(2);
} else {
// The shield is due to mixed content, just keep a count so we can
// normalize later.
histogram.add(3);
}
if (state &
(Ci.nsIWebProgressListener.STATE_LOADED_MIXED_ACTIVE_CONTENT |
Ci.nsIWebProgressListener.STATE_LOADED_TRACKING_CONTENT)) {

View File

@ -1819,6 +1819,10 @@
// places this host on the tracking protection white list.
Services.perms.add(normalizedUrl,
"trackingprotection", Services.perms.ALLOW_ACTION);
// Telemetry for disable protection
let histogram = Services.telemetry.getHistogramById(
"TRACKING_PROTECTION_EVENTS");
histogram.add(1);
BrowserReload();
]]></body>
</method>
@ -1829,6 +1833,10 @@
// from the tracking protection white list (any list actually).
Services.perms.remove(gBrowser.selectedBrowser.currentURI.host,
"trackingprotection");
// Telemetry for enable protection
let histogram = Services.telemetry.getHistogramById(
"TRACKING_PROTECTION_EVENTS");
histogram.add(2);
BrowserReload();
]]></body>
</method>

View File

@ -6506,5 +6506,22 @@
"high": "10000000",
"n_buckets": 10,
"description": "Sidebar showing: seconds that the sidebar has been opened"
},
"TRACKING_PROTECTION_ENABLED": {
"expires_in_version": "never",
"kind": "boolean",
"description": "Whether or not a session has tracking protection enabled"
},
"TRACKING_PROTECTION_SHIELD": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 4,
"description": "Tracking protection shield (0 = not shown, 1 = blocked, 2 = loaded, 3 = due to mixed content"
},
"TRACKING_PROTECTION_EVENTS": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 3,
"description": "Doorhanger shown = 0, Disable = 1, Enable = 2"
}
}