From 4c043d8a00cad291bbc5101c45313d30f1284aef Mon Sep 17 00:00:00 2001 From: lianahus Date: Mon, 9 Aug 2021 13:09:26 +0200 Subject: [PATCH] track context menu special actions usage --- .../src/lib/file-explorer-context-menu.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libs/remix-ui/file-explorer/src/lib/file-explorer-context-menu.tsx b/libs/remix-ui/file-explorer/src/lib/file-explorer-context-menu.tsx index a8a31fd6c8..3d85829294 100644 --- a/libs/remix-ui/file-explorer/src/lib/file-explorer-context-menu.tsx +++ b/libs/remix-ui/file-explorer/src/lib/file-explorer-context-menu.tsx @@ -4,6 +4,13 @@ import { action, FileExplorerContextMenuProps } from './types' import './css/file-explorer-context-menu.css' import { customAction } from '@remixproject/plugin-api/lib/file-system/file-panel' +declare global { + interface Window { + _paq: any + } +} +const _paq = window._paq = window._paq || [] //eslint-disable-line + export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => { const { actions, createNewFile, createNewFolder, deletePath, renamePath, hideContextMenu, pushChangesToGist, publishFileToGist, publishFolderToGist, copy, paste, runScript, emit, pageX, pageY, path, type, focus, ...otherProps } = props const contextMenuRef = useRef(null) @@ -76,15 +83,19 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => deletePath(getPath()) break case 'Push changes to gist': + _paq.push(['trackEvent', 'fileExplorer', 'pushToChangesoGist']) pushChangesToGist(path, type) break case 'Publish folder to gist': + _paq.push(['trackEvent', 'fileExplorer', 'publishFolderToGist']) publishFolderToGist(path, type) break case 'Publish file to gist': + _paq.push(['trackEvent', 'fileExplorer', 'publishFileToGist']) publishFileToGist(path, type) break case 'Run': + _paq.push(['trackEvent', 'fileExplorer', 'runScript']) runScript(path) break case 'Copy': @@ -97,6 +108,7 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) => deletePath(getPath()) break default: + _paq.push(['trackEvent', 'fileExplorer', 'customAction', item.name]) emit && emit({ ...item, path: [path] } as customAction) break }