Skip to content

Commit eb8833f

Browse files
authored
Merge pull request #4961 from ethereum/matomoplugin
add matomo plugin
2 parents 42104c3 + 12c5712 commit eb8833f

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

apps/remix-ide/src/app.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import { xtermPlugin } from './app/plugins/electron/xtermPlugin'
5656
import { ripgrepPlugin } from './app/plugins/electron/ripgrepPlugin'
5757
import { compilerLoaderPlugin, compilerLoaderPluginDesktop } from './app/plugins/electron/compilerLoaderPlugin'
5858
import { GitPlugin } from './app/plugins/git'
59+
import { Matomo } from './app/plugins/matomo'
5960

6061
import {SolCoder} from './app/plugins/solcoderAI'
6162

@@ -223,6 +224,9 @@ class AppComponent {
223224
//---- git
224225
const git = new GitPlugin()
225226

227+
//---- matomo
228+
const matomo = new Matomo()
229+
226230
//---------------- Solidity UML Generator -------------------------
227231
const solidityumlgen = new SolidityUmlGen(appManager)
228232

@@ -357,7 +361,8 @@ class AppComponent {
357361
templates,
358362
solcoder,
359363
git,
360-
pluginStateLogger
364+
pluginStateLogger,
365+
matomo
361366
])
362367

363368
//---- fs plugin
@@ -476,7 +481,8 @@ class AppComponent {
476481
'network',
477482
'web3Provider',
478483
'offsetToLineColumnConverter',
479-
'pluginStateLogger'
484+
'pluginStateLogger',
485+
'matomo'
480486
])
481487
await this.appManager.activatePlugin(['mainPanel', 'menuicons', 'tabs'])
482488
await this.appManager.activatePlugin(['statusBar'])
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'use strict'
2+
import { Plugin } from '@remixproject/engine'
3+
4+
const _paq = window._paq = window._paq || []
5+
6+
const profile = {
7+
name: 'matomo',
8+
description: 'send analytics to Matomo',
9+
methods: ['track'],
10+
events: [''],
11+
version: '1.0.0'
12+
}
13+
14+
const allowedPlugins = ['LearnEth', 'etherscan', 'vyper', 'circuit-compiler', 'doc-gen', 'doc-viewer', 'solhint', 'walletconnect', 'scriptRunner']
15+
16+
export class Matomo extends Plugin {
17+
18+
constructor() {
19+
super(profile)
20+
}
21+
22+
async track(data: string[]) {
23+
if (!allowedPlugins.includes(this.currentRequest.from)) return
24+
_paq.push(data)
25+
}
26+
}

apps/remix-ide/src/remixAppManager.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ let requiredModules = [ // services + layout views + system views
8181
'dgit',
8282
'pinnedPanel',
8383
'pluginStateLogger',
84-
'remixGuide'
84+
'remixGuide',
85+
'matomo'
8586
]
8687

8788

0 commit comments

Comments
 (0)