зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1542334 - Add telemetry for FxA app menu r=eoger,janerik
Differential Revision: https://phabricator.services.mozilla.com/D28347 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f88dffff7e
Коммит
313d36d38b
|
@ -216,6 +216,21 @@ var gSync = {
|
|||
this.populateSendTabToDevicesView(panelViewNode, this.populateSendTabToDevicesView.bind(this));
|
||||
},
|
||||
|
||||
showSendToDeviceViewFromFxaMenu(anchor) {
|
||||
this.showSendToDeviceView(anchor);
|
||||
this.emitFxaToolbarTelemetry("send_tab", anchor);
|
||||
},
|
||||
|
||||
showRemoteTabsFromFxaMenu(panel) {
|
||||
PanelUI.showSubView("PanelUI-remotetabs", panel);
|
||||
this.emitFxaToolbarTelemetry("sync_tabs", panel);
|
||||
},
|
||||
|
||||
showSidebarFromFxaMenu(panel) {
|
||||
SidebarUI.toggle("viewTabsSidebar");
|
||||
this.emitFxaToolbarTelemetry("sync_tabs_sidebar", panel);
|
||||
},
|
||||
|
||||
populateSendTabToDevicesView(panelViewNode, reloadFunc) {
|
||||
let bodyNode = panelViewNode.querySelector(".panel-subview-body");
|
||||
let panelNode = panelViewNode.closest("panel");
|
||||
|
@ -294,7 +309,7 @@ var gSync = {
|
|||
if (anchor.getAttribute("open") == "true") {
|
||||
PanelUI.hide();
|
||||
} else {
|
||||
this.emitFxaToolbarTelemetry("toolbar_icon");
|
||||
this.emitFxaToolbarTelemetry("toolbar_icon", anchor);
|
||||
PanelUI.showSubView(viewId, anchor, aEvent);
|
||||
}
|
||||
},
|
||||
|
@ -355,16 +370,29 @@ var gSync = {
|
|||
}
|
||||
},
|
||||
|
||||
emitFxaToolbarTelemetry(type) {
|
||||
if (!gFxaToolbarEnabled) {
|
||||
return;
|
||||
}
|
||||
if (UIState.isReady()) {
|
||||
emitFxaToolbarTelemetry(type, panel) {
|
||||
if (UIState.isReady() && panel) {
|
||||
const state = UIState.get();
|
||||
const hasAvatar = state.avatarURL && !state.avatarURL.includes(FXA_NO_AVATAR_ZEROS);
|
||||
let extraOptions = {"fxa_status": state.status, "fxa_avatar": hasAvatar ? "true" : "false"};
|
||||
Services.telemetry.recordEvent("fxa_avatar_menu", "click", type, null, extraOptions);
|
||||
|
||||
// When the fxa avatar panel is within the Firefox app menu,
|
||||
// we emit different telemetry.
|
||||
let eventName = "fxa_avatar_menu";
|
||||
if (this.isPanelInsideAppMenu(panel)) {
|
||||
eventName = "fxa_app_menu";
|
||||
}
|
||||
|
||||
Services.telemetry.recordEvent(eventName, "click", type, null, extraOptions);
|
||||
}
|
||||
},
|
||||
|
||||
isPanelInsideAppMenu(panel = undefined) {
|
||||
const appMenuPanel = document.getElementById("appMenu-popup");
|
||||
if (panel && appMenuPanel.contains(panel)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
updatePanelPopup(state) {
|
||||
|
@ -447,6 +475,7 @@ var gSync = {
|
|||
switch (this.appMenuContainer.getAttribute("fxastatus")) {
|
||||
case "signedin":
|
||||
const panel = document.getElementById("appMenu-fxa-status");
|
||||
this.emitFxaToolbarTelemetry("toolbar_icon", panel);
|
||||
PanelUI.showSubView("PanelUI-fxa", panel);
|
||||
break;
|
||||
case "error":
|
||||
|
@ -485,6 +514,15 @@ var gSync = {
|
|||
openTrustedLinkIn(url, "tab");
|
||||
},
|
||||
|
||||
async openConnectAnotherDeviceFromFxaMenu(panel = undefined) {
|
||||
this.emitFxaToolbarTelemetry("cad", panel);
|
||||
let entryPoint = "fxa_discoverability_native";
|
||||
if (this.isPanelInsideAppMenu(panel)) {
|
||||
entryPoint = "fxa_app_menu";
|
||||
}
|
||||
this.openConnectAnotherDevice(entryPoint);
|
||||
},
|
||||
|
||||
openSendToDevicePromo() {
|
||||
let url = this.PRODUCT_INFO_BASE_URL;
|
||||
url += "send-tabs/?utm_source=" + Services.appinfo.name.toLowerCase();
|
||||
|
@ -496,11 +534,29 @@ var gSync = {
|
|||
switchToTabHavingURI(url, true, { replaceQueryString: true });
|
||||
},
|
||||
|
||||
async openFxAEmailFirstPageFromFxaMenu(panel = undefined) {
|
||||
this.emitFxaToolbarTelemetry("login", panel);
|
||||
let entryPoint = "fxa_discoverability_native";
|
||||
if (this.isPanelInsideAppMenu(panel)) {
|
||||
entryPoint = "fxa_app_menu";
|
||||
}
|
||||
this.openFxAEmailFirstPage(entryPoint);
|
||||
},
|
||||
|
||||
async openFxAManagePage(entryPoint) {
|
||||
const url = await FxAccounts.config.promiseManageURI(entryPoint);
|
||||
switchToTabHavingURI(url, true, { replaceQueryString: true });
|
||||
},
|
||||
|
||||
async openFxAManagePageFromFxaMenu(panel = undefined) {
|
||||
this.emitFxaToolbarTelemetry("account_settings", panel);
|
||||
let entryPoint = "fxa_discoverability_native";
|
||||
if (this.isPanelInsideAppMenu(panel)) {
|
||||
entryPoint = "fxa_app_menu";
|
||||
}
|
||||
this.openFxAManagePage(entryPoint);
|
||||
},
|
||||
|
||||
async sendTabToDevice(url, targets, title) {
|
||||
const fxaCommandsDevices = [];
|
||||
const oldSendTabClients = [];
|
||||
|
@ -847,10 +903,24 @@ var gSync = {
|
|||
}
|
||||
},
|
||||
|
||||
doSyncFromFxaMenu(panel) {
|
||||
this.doSync();
|
||||
this.emitFxaToolbarTelemetry("sync_now", panel);
|
||||
},
|
||||
|
||||
openPrefs(entryPoint = "syncbutton", origin = undefined) {
|
||||
window.openPreferences("paneSync", { origin, urlParams: { entrypoint: entryPoint } });
|
||||
},
|
||||
|
||||
openPrefsFromFxaMenu(type, panel) {
|
||||
this.emitFxaToolbarTelemetry(type, panel);
|
||||
let entryPoint = "fxa_discoverability_native";
|
||||
if (this.isPanelInsideAppMenu(panel)) {
|
||||
entryPoint = "fxa_app_menu";
|
||||
}
|
||||
this.openPrefs(entryPoint);
|
||||
},
|
||||
|
||||
openSyncedTabsPanel() {
|
||||
let placement = CustomizableUI.getPlacementOfWidget("sync-button");
|
||||
let area = placement && placement.area;
|
||||
|
|
|
@ -494,6 +494,8 @@ function showFxaToolbarMenu(enable) {
|
|||
mainWindowEl.setAttribute("fxastatus", "not_configured");
|
||||
fxaPanelEl.addEventListener("ViewShowing", gSync.updateSendToDeviceTitle);
|
||||
|
||||
Services.telemetry.setEventRecordingEnabled("fxa_app_menu", true);
|
||||
|
||||
if (enable && syncEnabled) {
|
||||
mainWindowEl.setAttribute("fxatoolbarmenu", "visible");
|
||||
|
||||
|
@ -502,7 +504,6 @@ function showFxaToolbarMenu(enable) {
|
|||
// event was performed yet.
|
||||
gSync.maybeUpdateUIState();
|
||||
|
||||
// Enabled FxA toolbar telemetry
|
||||
Services.telemetry.setEventRecordingEnabled("fxa_avatar_menu", true);
|
||||
|
||||
// We set an attribute here so that we can toggle the custom
|
||||
|
|
|
@ -693,7 +693,7 @@
|
|||
<label class="PanelUI-fxa-signin-instruction-label">&fxa.signin.description.label;</label>
|
||||
<toolbarbutton class="PanelUI-fxa-signin-button"
|
||||
label="&fxa.signin.button.label;"
|
||||
oncommand="gSync.openFxAEmailFirstPage('fxa_discoverability_native'); gSync.emitFxaToolbarTelemetry('login');"/>
|
||||
oncommand="gSync.openFxAEmailFirstPageFromFxaMenu(this);"/>
|
||||
</vbox>
|
||||
<vbox id="PanelUI-fxa-unverified" class="PanelUI-fxa-unverified-instruction-box">
|
||||
<image class="fxaGraphicMail"/>
|
||||
|
@ -701,7 +701,7 @@
|
|||
<label class="PanelUI-fxa-signin-instruction-label">&fxa.unverified.description.label;</label>
|
||||
<toolbarbutton class="PanelUI-fxa-signin-button"
|
||||
label="&fxa.unverified.button.label;"
|
||||
oncommand="gSync.openPrefs('fxa_discoverability_native'); gSync.emitFxaToolbarTelemetry('unver_sync_settings');"/>
|
||||
oncommand="gSync.openPrefsFromFxaMenu('unver_sync_settings', this);"/>
|
||||
</vbox>
|
||||
<vbox id="PanelUI-fxa-menu">
|
||||
<hbox flex="1" align="center" class="fxa-avatar-subpanel">
|
||||
|
@ -715,34 +715,34 @@
|
|||
<toolbarbutton id="PanelUI-fxa-menu-sendtab-button"
|
||||
class="subviewbutton subviewbutton-iconic subviewbutton-nav"
|
||||
closemenu="none"
|
||||
oncommand="gSync.showSendToDeviceView(this); gSync.emitFxaToolbarTelemetry('send_tab');"/>
|
||||
oncommand="gSync.showSendToDeviceViewFromFxaMenu(this);"/>
|
||||
<toolbarbutton id="PanelUI-fxa-menu-remotetabs-button"
|
||||
class="subviewbutton subviewbutton-iconic subviewbutton-nav"
|
||||
label="&appMenuRemoteTabs.label;"
|
||||
closemenu="none"
|
||||
oncommand="PanelUI.showSubView('PanelUI-remotetabs', this); gSync.emitFxaToolbarTelemetry('sync_tabs');"/>
|
||||
oncommand="gSync.showRemoteTabsFromFxaMenu(this);"/>
|
||||
<toolbarbutton id="PanelUI-fxa-menu-view-sidebar"
|
||||
class="subviewbutton subviewbutton-iconic"
|
||||
label="&appMenuRemoteTabs.sidebar.label;"
|
||||
oncommand="SidebarUI.toggle('viewTabsSidebar'); gSync.emitFxaToolbarTelemetry('sync_tabs_sidebar');">
|
||||
oncommand="gSync.showSidebarFromFxaMenu(this);">
|
||||
<observes element="sidebar-box" attribute="positionend"/>
|
||||
</toolbarbutton>
|
||||
<toolbarseparator/>
|
||||
<toolbarbutton class="subviewbutton"
|
||||
label="&fxa.menu.connectAnotherDevice2.label;"
|
||||
oncommand="gSync.openConnectAnotherDevice('fxa_discoverability_native'); gSync.emitFxaToolbarTelemetry('cad');"/>
|
||||
oncommand="gSync.openConnectAnotherDeviceFromFxaMenu(this);"/>
|
||||
<toolbarbutton class="subviewbutton"
|
||||
label="&fxa.menu.manageAccount.label;"
|
||||
oncommand="gSync.openFxAManagePage('fxa_discoverability_native'); gSync.emitFxaToolbarTelemetry('account_settings');"/>
|
||||
oncommand="gSync.openFxAManagePageFromFxaMenu(this);"/>
|
||||
<toolbarbutton class="subviewbutton"
|
||||
label="&fxa.menu.syncSettings.label;"
|
||||
oncommand="gSync.openPrefs('fxa_discoverability_native'); gSync.emitFxaToolbarTelemetry('sync_settings');"/>
|
||||
oncommand="gSync.openPrefsFromFxaMenu('sync_settings', this);"/>
|
||||
<toolbarseparator/>
|
||||
<toolbarbutton id="PanelUI-fxa-menu-syncnow-button"
|
||||
label="&syncSyncNowItem.label;"
|
||||
syncinglabel="&syncSyncNowItemSyncing.label;"
|
||||
class="subviewbutton subviewbutton-iconic"
|
||||
oncommand="gSync.doSync(); gSync.emitFxaToolbarTelemetry('sync_now');"
|
||||
oncommand="gSync.doSyncFromFxaMenu(this);"
|
||||
closemenu="none"/>
|
||||
</vbox>
|
||||
</vbox>
|
||||
|
|
|
@ -367,6 +367,31 @@ fxa_avatar_menu:
|
|||
"signedin" and "login_failed".
|
||||
fxa_avatar: Boolean for whether or not account has set an avatar
|
||||
|
||||
fxa_app_menu:
|
||||
click:
|
||||
objects: [
|
||||
"account_settings",
|
||||
"cad",
|
||||
"send_tab",
|
||||
"sync_now",
|
||||
"sync_settings",
|
||||
"sync_tabs",
|
||||
"sync_tabs_sidebar",
|
||||
"toolbar_icon"
|
||||
]
|
||||
methods: ["click"]
|
||||
release_channel_collection: opt-out
|
||||
record_in_processes: ["main"]
|
||||
description: This is recorded on interactions with the FxA menu in the app (hamburger) menu
|
||||
bug_numbers: [1542334]
|
||||
notification_emails: ["vbudhram@mozilla.com", "loines@mozilla.com"]
|
||||
expiry_version: "73"
|
||||
extra_keys:
|
||||
fxa_status: >
|
||||
The current state of the user. Possible states are "not_configured", "unverified",
|
||||
"signedin" and "login_failed".
|
||||
fxa_avatar: Boolean for whether or not account has set an avatar
|
||||
|
||||
# This category contains event entries used for Telemetry tests.
|
||||
# They will not be sent out with any pings.
|
||||
telemetry.test:
|
||||
|
|
Загрузка…
Ссылка в новой задаче