diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index b59568e70b..3e0eacdeb0 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -56,6 +56,7 @@ import { xtermPlugin } from './app/plugins/electron/xtermPlugin' import { ripgrepPlugin } from './app/plugins/electron/ripgrepPlugin' import { compilerLoaderPlugin, compilerLoaderPluginDesktop } from './app/plugins/electron/compilerLoaderPlugin' import { GitPlugin } from './app/plugins/git' +import { Matomo } from './app/plugins/matomo' import {SolCoder} from './app/plugins/solcoderAI' @@ -223,6 +224,9 @@ class AppComponent { //---- git const git = new GitPlugin() + //---- matomo + const matomo = new Matomo() + //---------------- Solidity UML Generator ------------------------- const solidityumlgen = new SolidityUmlGen(appManager) @@ -357,7 +361,8 @@ class AppComponent { templates, solcoder, git, - pluginStateLogger + pluginStateLogger, + matomo ]) //---- fs plugin @@ -476,7 +481,8 @@ class AppComponent { 'network', 'web3Provider', 'offsetToLineColumnConverter', - 'pluginStateLogger' + 'pluginStateLogger', + 'matomo' ]) await this.appManager.activatePlugin(['mainPanel', 'menuicons', 'tabs']) await this.appManager.activatePlugin(['statusBar']) diff --git a/apps/remix-ide/src/app/files/fileManager.ts b/apps/remix-ide/src/app/files/fileManager.ts index c9f1c1d93d..e232c2a132 100644 --- a/apps/remix-ide/src/app/files/fileManager.ts +++ b/apps/remix-ide/src/app/files/fileManager.ts @@ -25,7 +25,8 @@ const profile = { methods: ['closeAllFiles', 'closeFile', 'file', 'exists', 'open', 'writeFile', 'writeMultipleFiles', 'writeFileNoRewrite', 'readFile', 'copyFile', 'copyDir', 'rename', 'mkdir', 'readdir', 'dirList', 'fileList', 'remove', 'getCurrentFile', 'getFile', 'getFolder', 'setFile', 'switchFile', 'refresh', 'getProviderOf', 'getProviderByName', 'getPathFromUrl', 'getUrlFromPath', - 'saveCurrentFile', 'setBatchFiles', 'isGitRepo', 'isFile', 'isDirectory', 'hasGitSubmodule', 'copyFolderToJson', 'diff' + 'saveCurrentFile', 'setBatchFiles', 'isGitRepo', 'isFile', 'isDirectory', 'hasGitSubmodule', 'copyFolderToJson', 'diff', + 'hasGitSubmodules' ], kind: 'file-system' } diff --git a/apps/remix-ide/src/app/plugins/matomo.ts b/apps/remix-ide/src/app/plugins/matomo.ts new file mode 100644 index 0000000000..9495d1ddd7 --- /dev/null +++ b/apps/remix-ide/src/app/plugins/matomo.ts @@ -0,0 +1,26 @@ +'use strict' +import { Plugin } from '@remixproject/engine' + +const _paq = window._paq = window._paq || [] + +const profile = { + name: 'matomo', + description: 'send analytics to Matomo', + methods: ['track'], + events: [''], + version: '1.0.0' +} + +const allowedPlugins = ['LearnEth', 'etherscan', 'vyper', 'circuit-compiler', 'doc-gen', 'doc-viewer', 'solhint', 'walletconnect', 'scriptRunner'] + +export class Matomo extends Plugin { + + constructor() { + super(profile) + } + + async track(data: string[]) { + if (!allowedPlugins.includes(this.currentRequest.from)) return + _paq.push(data) + } +} \ No newline at end of file diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index d430d678d7..20b69d984f 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -81,7 +81,8 @@ let requiredModules = [ // services + layout views + system views 'dgit', 'pinnedPanel', 'pluginStateLogger', - 'remixGuide' + 'remixGuide', + 'matomo' ]