Skip to content

Commit

Permalink
add matomo plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
bunsenstraat committed Jul 5, 2024
1 parent 88e16ab commit 49a781d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
10 changes: 8 additions & 2 deletions apps/remix-ide/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -223,6 +224,9 @@ class AppComponent {
//---- git
const git = new GitPlugin()

//---- matomo
const matomo = new Matomo()

//---------------- Solidity UML Generator -------------------------
const solidityumlgen = new SolidityUmlGen(appManager)

Expand Down Expand Up @@ -357,7 +361,8 @@ class AppComponent {
templates,
solcoder,
git,
pluginStateLogger
pluginStateLogger,
matomo
])

//---- fs plugin
Expand Down Expand Up @@ -476,7 +481,8 @@ class AppComponent {
'network',
'web3Provider',
'offsetToLineColumnConverter',
'pluginStateLogger'
'pluginStateLogger',
'matomo'
])
await this.appManager.activatePlugin(['mainPanel', 'menuicons', 'tabs'])
await this.appManager.activatePlugin(['statusBar'])
Expand Down
26 changes: 26 additions & 0 deletions apps/remix-ide/src/app/plugins/matomo.ts
Original file line number Diff line number Diff line change
@@ -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)
}
}
3 changes: 2 additions & 1 deletion apps/remix-ide/src/remixAppManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ let requiredModules = [ // services + layout views + system views
'dgit',
'pinnedPanel',
'pluginStateLogger',
'remixGuide'
'remixGuide',
'matomo'
]


Expand Down

0 comments on commit 49a781d

Please sign in to comment.