added matomo tracking for FE actions

pull/5370/head
lianahus 2 years ago
parent d2f9d292c9
commit ff3445f97e
  1. 7
      libs/remix-ui/workspace/src/lib/components/file-explorer-context-menu.tsx
  2. 2
      libs/remix-ui/workspace/src/lib/components/file-explorer-menu.tsx

@ -72,15 +72,19 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) =>
switch (item.name) {
case 'New File':
createNewFile(path)
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'newFile'])
break
case 'New Folder':
createNewFolder(path)
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'newFolder'])
break
case 'Rename':
renamePath(path, type)
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'rename'])
break
case 'Delete':
deletePath(getPath())
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'delete'])
break
case 'Push changes to gist':
_paq.push(['trackEvent', 'fileExplorer', 'pushToChangesoGist'])
@ -100,12 +104,15 @@ export const FileExplorerContextMenu = (props: FileExplorerContextMenuProps) =>
break
case 'Copy':
copy(path, type)
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'copy'])
break
case 'Paste':
paste(path, type)
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'past'])
break
case 'Delete All':
deletePath(getPath())
_paq.push(['trackEvent', 'fileExplorer', 'contextMenu', 'deleteAll'])
break
default:
_paq.push(['trackEvent', 'fileExplorer', 'customAction', `${item.id}/${item.name}`])

@ -1,5 +1,6 @@
import React, { useState, useEffect } from 'react' //eslint-disable-line
import { FileExplorerMenuProps } from '../types'
const _paq = window._paq = window._paq || []
export const FileExplorerMenu = (props: FileExplorerMenuProps) => {
const [state, setState] = useState({
@ -72,6 +73,7 @@ export const FileExplorerMenu = (props: FileExplorerMenuProps) => {
data-id={'fileExplorerNewFile' + action}
onClick={(e) => {
e.stopPropagation()
_paq.push(['trackEvent', 'fileExplorer', 'fileAction', action])
if (action === 'createNewFile') {
props.createNewFile()
} else if (action === 'createNewFolder') {

Loading…
Cancel
Save