From 1bf31d241c1a69463477d93f5ca382f0c010fd86 Mon Sep 17 00:00:00 2001 From: abose Date: Sat, 10 Oct 2026 02:54:05 +0530 Subject: [PATCH] fix(metrics): distinguish app menu clicks from context menus Record application menu commands under appMenu.click while retaining UIMenu.click for context menus and menus without an explicit metric type. Inherit the owning menu namespace through nested submenus and compact-menu flyouts so each command is attributed to the menu that invoked it. --- src/command/Menus.js | 6 +++++- src/utils/Metrics.js | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/command/Menus.js b/src/command/Menus.js index 9587046d0a..5c4ed88f0a 100644 --- a/src/command/Menus.js +++ b/src/command/Menus.js @@ -455,6 +455,8 @@ define(function (require, exports, module) { */ function Menu(id) { this.id = id; + // Submenus inherit their owner's namespace even though they render as context menus. + this._metricsEventType = Metrics.EVENT_TYPE.APP_MENU; } Menu.prototype._getMenuItemId = function (commandId) { @@ -733,7 +735,7 @@ define(function (require, exports, module) { event.stopPropagation(); return true; } - Metrics.countEvent(Metrics.EVENT_TYPE.UI_MENU, "click", menuItem._command.getID()); + Metrics.countEvent(self._metricsEventType || Metrics.EVENT_TYPE.UI_MENU, "click", menuItem._command.getID()); logger.leaveTrail("UI Menu Click: " + menuItem._command.getID()); MainViewManager.focusActivePane(); const commandId = menuItem._command.getID(); @@ -909,6 +911,7 @@ define(function (require, exports, module) { } let menu = new ContextMenu(id); + menu._metricsEventType = this._metricsEventType; contextMenuMap[id] = menu; let menuItemID = this.id + "-" + id; @@ -1544,6 +1547,7 @@ define(function (require, exports, module) { */ function ContextMenu(id) { Menu.apply(this, arguments); + this._metricsEventType = Metrics.EVENT_TYPE.UI_MENU; let $newMenu = $(""), $popUp = $(""), diff --git a/src/utils/Metrics.js b/src/utils/Metrics.js index 245bf78b63..4826391cb5 100644 --- a/src/utils/Metrics.js +++ b/src/utils/Metrics.js @@ -92,8 +92,9 @@ define(function (require, exports, module) { * The Type of events that can be specified as an `eventType` in the API calls. * * ### Properties - * `PLATFORM`, `PROJECT`, `THEMES`, `EXTENSIONS`, `EXTENSIONS`, `UI`, `UI_DIALOG`, `UI_BOTTOM_PANEL`, - * `UI_SIDE_PANEL`, `LIVE_PREVIEW`, `CODE_HINTS`, `EDITOR`, `SEARCH`, `SHARING`, `PERFORMANCE`, `NEW_PROJECT` + * `PLATFORM`, `PROJECT`, `THEMES`, `EXTENSIONS`, `EXTENSIONS`, `UI`, `APP_MENU`, `UI_MENU`, `UI_DIALOG`, + * `UI_BOTTOM_PANEL`, `UI_SIDE_PANEL`, `LIVE_PREVIEW`, `CODE_HINTS`, `EDITOR`, `SEARCH`, `SHARING`, + * `PERFORMANCE`, `NEW_PROJECT` * `ERROR`, `USER`, `NODEJS`, `LINT`, `GIT`, `AUTH`, `PRO`, `GUIDE` * * @typedef EVENT_TYPE @@ -106,6 +107,7 @@ define(function (require, exports, module) { EXTENSIONS: "extensions", NOTIFICATIONS: "notify", UI: "UI", + APP_MENU: "appMenu", UI_MENU: "UIMenu", UI_DIALOG: "ui-dialog", UI_BOTTOM_PANEL: "ui-bottomPanel",