Bug 1036581 add telemetry probes to social buttons and sidebar, r=dolske

This commit is contained in:
Shane Caraveo 2014-07-16 19:15:02 -07:00
Родитель 69ed25e952
Коммит 3c40216d24
3 изменённых файлов: 69 добавлений и 6 удалений

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

@ -578,12 +578,18 @@ SocialShare = {
}
},
_onclick: function() {
Services.telemetry.getHistogramById("SOCIAL_PANEL_CLICKS").add(0);
},
onShowing: function() {
this.anchor.setAttribute("open", "true");
this.iframe.addEventListener("click", this._onclick, true);
},
onHidden: function() {
this.anchor.removeAttribute("open");
this.iframe.removeEventListener("click", this._onclick, true);
this.iframe.setAttribute("src", "data:text/plain;charset=utf8,");
this.currentShare = null;
},
@ -704,10 +710,13 @@ SocialShare = {
let anchor = document.getAnonymousElementByAttribute(this.anchor, "class", "toolbarbutton-icon");
this.panel.openPopup(anchor, "bottomcenter topright", 0, 0, false, false);
Social.setErrorListener(iframe, this.setErrorMessage.bind(this));
Services.telemetry.getHistogramById("SOCIAL_TOOLBAR_BUTTONS").add(0);
}
};
SocialSidebar = {
_openStartTime: 0,
// Whether the sidebar can be shown for this window.
get canShow() {
if (!SocialUI.enabled || document.mozFullScreen)
@ -780,6 +789,11 @@ SocialSidebar = {
"hidden": broadcaster.hidden,
"origin": sidebarOrigin
};
if (broadcaster.hidden) {
Services.telemetry.getHistogramById("SOCIAL_SIDEBAR_OPEN_DURATION").add(Date.now() / 1000 - this._openStartTime);
} else {
this._openStartTime = Date.now() / 1000;
}
// Save a global state for users who do not restore state.
if (broadcaster.hidden)
@ -877,11 +891,16 @@ SocialSidebar = {
this._updateCheckedMenuItems(this.opened && this.provider ? this.provider.origin : null);
},
_onclick: function() {
Services.telemetry.getHistogramById("SOCIAL_PANEL_CLICKS").add(3);
},
_loadListener: function SocialSidebar_loadListener() {
let sbrowser = document.getElementById("social-sidebar-browser");
sbrowser.removeEventListener("load", SocialSidebar._loadListener, true);
document.getElementById("social-sidebar-button").removeAttribute("loading");
SocialSidebar.setSidebarVisibilityState(true);
sbrowser.addEventListener("click", SocialSidebar._onclick, true);
},
unloadSidebar: function SocialSidebar_unloadSidebar() {
@ -889,6 +908,7 @@ SocialSidebar = {
if (!sbrowser.hasAttribute("origin"))
return;
sbrowser.removeEventListener("click", SocialSidebar._onclick, true);
sbrowser.stop();
sbrowser.removeAttribute("origin");
sbrowser.setAttribute("src", "about:blank");
@ -989,6 +1009,7 @@ SocialSidebar = {
else
SocialSidebar.update();
this.saveWindowState();
Services.telemetry.getHistogramById("SOCIAL_SIDEBAR_STATE").add(true);
},
hide: function() {
@ -998,6 +1019,7 @@ SocialSidebar = {
this.clearProviderMenus();
SocialSidebar.update();
this.saveWindowState();
Services.telemetry.getHistogramById("SOCIAL_SIDEBAR_STATE").add(false);
},
toggleSidebar: function SocialSidebar_toggle() {
@ -1219,13 +1241,29 @@ SocialStatus = {
}
},
_onclose: function() {
let notificationFrameId = "social-status-" + origin;
let frame = document.getElementById(notificationFrameId);
frame.removeEventListener("close", this._onclose, true);
frame.removeEventListener("click", this._onclick, true);
},
_onclick: function() {
Services.telemetry.getHistogramById("SOCIAL_PANEL_CLICKS").add(1);
},
showPopup: function(aToolbarButton) {
// attach our notification panel if necessary
let origin = aToolbarButton.getAttribute("origin");
let provider = Social._getProviderFromOrigin(origin);
PanelFrame.showPopup(window, PanelUI, aToolbarButton, "social", origin,
provider.statusURL, provider.getPageSize("status"));
provider.statusURL, provider.getPageSize("status"),
(frame) => {
frame.addEventListener("close", this._onclose, true);
frame.addEventListener("click", this._onclick, true);
});
Services.telemetry.getHistogramById("SOCIAL_TOOLBAR_BUTTONS").add(1);
},
setPanelErrorMessage: function(aNotificationFrame) {

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

@ -235,6 +235,7 @@
setTimeout(() => {
panel.openPopup(anchor, "bottomcenter topright", 0, 0, false, false);
}, 0);
Services.telemetry.getHistogramById("SOCIAL_TOOLBAR_BUTTONS").add(2);
]]></body>
</method>
@ -330,6 +331,9 @@
this.setAttribute("image", uri.spec);
}
break;
case "click":
Services.telemetry.getHistogramById("SOCIAL_PANEL_CLICKS").add(2);
break;
}
]]></body>
</method>
@ -338,6 +342,7 @@
<handlers>
<handler event="popupshowing"><![CDATA[
this._anchor.setAttribute("open", "true");
this.content.addEventListener("click", this);
]]></handler>
<handler event="popupshown"><![CDATA[
this.onShown();
@ -346,6 +351,7 @@
this.dispatchPanelEvent("socialFrameHide");
this._anchor.removeAttribute("open");
this.update();
this.content.removeEventListener("click", this);
]]></handler>
<handler event="command"><![CDATA[
this.markCurrentPage();

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

@ -4517,11 +4517,6 @@
"kind": "flag",
"description": "Social has been enabled at least once on the current session"
},
"SOCIAL_TOGGLED": {
"expires_in_version": "never",
"kind": "boolean",
"description": "Social has been toggled to on or off"
},
"ENABLE_PRIVILEGE_EVER_CALLED": {
"expires_in_version": "never",
"kind": "flag",
@ -6564,5 +6559,29 @@
"n_buckets": "100",
"description": "Scaling percentage for the display where the first window is opened (Linux only)",
"cpp_guard": "XP_LINUX"
},
"SOCIAL_SIDEBAR_STATE": {
"expires_in_version": "never",
"kind": "boolean",
"description": "Social Sidebar state 0: closed, 1: opened. Toggling between providers will result in a higher opened rate."
},
"SOCIAL_TOOLBAR_BUTTONS": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 3,
"description": "Social toolbar button has been used (0:share, 1:status, 2:bookmark)"
},
"SOCIAL_PANEL_CLICKS": {
"expires_in_version": "never",
"kind": "enumerated",
"n_values": 4,
"description": "Social content has been interacted with (0:share, 1:status, 2:bookmark, 3: sidebar)"
},
"SOCIAL_SIDEBAR_OPEN_DURATION": {
"expires_in_version": "never",
"kind": "exponential",
"high": "10000000",
"n_buckets": 10,
"description": "Sidebar showing: seconds that the sidebar has been opened"
}
}