From 732663337b889d373ce0f21d209ca7dc9d51f9f9 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 8 Sep 2021 15:07:01 +0200 Subject: [PATCH] add Matomo trackEvent --- apps/remix-ide/src/app/tabs/test-tab.js | 4 ++++ apps/remix-ide/src/blockchain/blockchain.js | 3 +++ .../solidity-compiler/src/lib/logic/compileTabLogic.ts | 9 +++++++++ .../static-analyser/src/lib/remix-ui-static-analyser.tsx | 9 +++++++++ 4 files changed, 25 insertions(+) diff --git a/apps/remix-ide/src/app/tabs/test-tab.js b/apps/remix-ide/src/app/tabs/test-tab.js index 73c4c9aaef..afa3d1bc1c 100644 --- a/apps/remix-ide/src/app/tabs/test-tab.js +++ b/apps/remix-ide/src/app/tabs/test-tab.js @@ -9,6 +9,8 @@ var Renderer = require('../ui/renderer') var css = require('./styles/test-tab-styles') var { UnitTestRunner } = require('@remix-project/remix-tests') +const _paq = window._paq = window._paq || [] + const TestTabLogic = require('./testTab/testTab') const profile = { @@ -230,6 +232,7 @@ module.exports = class TestTab extends ViewPlugin { } finalLogs = finalLogs + ' ' + formattedLog + '\n' } + _paq.push(['trackEvent', 'solidityUnitTesting', 'hardhat', 'console.log']) this.call('terminal', 'log', { type: 'info', value: finalLogs }) } @@ -569,6 +572,7 @@ module.exports = class TestTab extends ViewPlugin { const tests = this.data.selectedTests if (!tests) return this.resultStatistics.hidden = tests.length === 0 + _paq.push(['trackEvent', 'solidityUnitTesting', 'runTests']) async.eachOfSeries(tests, (value, key, callback) => { if (this.hasBeenStopped) return this.runTest(value, callback) diff --git a/apps/remix-ide/src/blockchain/blockchain.js b/apps/remix-ide/src/blockchain/blockchain.js index 0d43b1451b..f0daf8d880 100644 --- a/apps/remix-ide/src/blockchain/blockchain.js +++ b/apps/remix-ide/src/blockchain/blockchain.js @@ -13,6 +13,8 @@ const { txFormat, txExecution, typeConversion, txListener: Txlistener, TxRunner, const { txResultHelper: resultToRemixTx } = helpers const packageJson = require('../../../../package.json') +const _paq = window._paq = window._paq || [] //eslint-disable-line + const profile = { name: 'blockchain', displayName: 'Blockchain', @@ -515,6 +517,7 @@ class Blockchain extends Plugin { } finalLogs = finalLogs + ' ' + formattedLog + '\n' } + _paq.push(['trackEvent', 'udapp', 'hardhat', 'console.log']) this.call('terminal', 'log', { type: 'info', value: finalLogs }) } execResult = await this.web3().eth.getExecutionResultFromSimulator(txResult.transactionHash) diff --git a/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts b/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts index 4b9be01c92..eaba281abe 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts +++ b/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts @@ -10,6 +10,14 @@ const profile = { methods: ['getCompilerState'], version: packageJson.version } + +declare global { + interface Window { + _paq: any + } +} +const _paq = window._paq = window._paq || [] //eslint-disable-line + export class CompileTab extends Plugin { public compiler public optimize @@ -115,6 +123,7 @@ export class CompileTab extends Plugin { ` const configFilePath = 'remix-compiler.config.js' this.api.writeFile(configFilePath, fileContent) + _paq.push(['trackEvent', 'compiler', 'compileWithHardhat']) this.call('hardhat', 'compile', configFilePath).then((result) => { this.call('terminal', 'log', { type: 'info', value: result }) }).catch((error) => { diff --git a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx index 612e1521f6..1e7fc77fd2 100644 --- a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx +++ b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx @@ -11,6 +11,13 @@ import { OverlayTrigger, Tooltip } from 'react-bootstrap'// eslint-disable-line const StaticAnalysisRunner = require('@remix-project/remix-analyzer').CodeAnalysis const utils = remixLib.util +declare global { + interface Window { + _paq: any + } +} +const _paq = window._paq = window._paq || [] //eslint-disable-line + /* eslint-disable-next-line */ export interface RemixUiStaticAnalyserProps { registry: any, @@ -154,6 +161,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { const warningErrors = [] // Remix Analysis + _paq.push(['trackEvent', 'solidityStaticAnalyzer', 'analyzeWithRemixAnalyzer']) runner.run(lastCompilationResult, categoryIndex, results => { results.map((result) => { let moduleName @@ -212,6 +220,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { props.analysisModule.call('solidity-logic', 'getCompilerState').then(async (compilerState) => { const { currentVersion, optimize, evmVersion } = compilerState props.analysisModule.call('terminal', 'log', { type: 'info', value: '[Slither Analysis]: Running...' }) + _paq.push(['trackEvent', 'solidityStaticAnalyzer', 'analyzeWithSlither']) props.analysisModule.call('slither', 'analyse', state.file, { currentVersion, optimize, evmVersion }).then(async (result) => { if (result.status) { props.analysisModule.call('terminal', 'log', { type: 'info', value: `[Slither Analysis]: Analysis Completed!! ${result.count} warnings found.` })