Skip to content

Commit 05b41bc

Browse files
committed
add matomo tracking to noir-compiler
1 parent b178b32 commit 05b41bc

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

apps/noir-compiler/src/app/components/container.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ import { FormattedMessage } from 'react-intl'
44
import { NoirAppContext } from '../contexts'
55
import { CompileOptions } from '@remix-ui/helper'
66
import { compileNoirCircuit } from '../actions'
7+
import { trackMatomoEvent, MatomoCategories } from '@remix-api'
78

89
const NOIR_VERSION = 'v1.0.0-beta.12'
910
const BARRETENBERG_VERSION = 'v0.85.0'
11+
const MATOMO_CATEGORY = MatomoCategories.NOIR_COMPILER
1012

1113
export function Container () {
1214
const noirApp = useContext(NoirAppContext)
@@ -32,17 +34,10 @@ export function Container () {
3234

3335
const handleOpenErrorLocation = async (report: CompilerReport) => {}
3436

35-
const handleCircuitAutoCompile = (value: boolean) => {
36-
noirApp.dispatch({ type: 'SET_AUTO_COMPILE', payload: value })
37-
}
38-
39-
const handleCircuitHideWarnings = (value: boolean) => {
40-
noirApp.dispatch({ type: 'SET_HIDE_WARNINGS', payload: value })
41-
}
42-
4337
const askGPT = async (report: CompilerReport) => {}
4438

4539
const handleCompileClick = () => {
40+
trackMatomoEvent(this, { category: MATOMO_CATEGORY, action: 'compile', name: 'compile_btn_click', isClick: true })
4641
compileNoirCircuit(noirApp.plugin, noirApp.appState)
4742
}
4843

@@ -51,17 +46,17 @@ export function Container () {
5146
console.error("No file path selected for generating proof.")
5247
return
5348
}
49+
trackMatomoEvent(this, { category: MATOMO_CATEGORY, action: 'generate_proof', name: 'generate_proof_btn_click', isClick: true })
5450
noirApp.plugin.generateProof(noirApp.appState.filePath)
5551
}
5652

5753
const handleViewFile = (e: React.MouseEvent<HTMLButtonElement>, filePath: string) => {
5854
e.preventDefault()
55+
const fileName = filePath.split('/').pop() || filePath
56+
trackMatomoEvent(this, { category: MATOMO_CATEGORY, action: 'view_file', name: fileName, isClick: true })
5957
noirApp.plugin.call('fileManager', 'open', filePath)
6058
}
6159

62-
63-
const formattedPublicInputsString = JSON.stringify(noirApp.appState.formattedPublicInputs, null, 2)
64-
6560
return (
6661
<section>
6762
<article>

libs/remix-api/src/lib/plugins/matomo/core/categories.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export const MatomoCategories = {
3030
SCRIPT_EXECUTOR: 'ScriptExecutor' as const,
3131
LOCALE_MODULE: 'localeModule' as const,
3232
THEME_MODULE: 'themeModule' as const,
33-
STATUS_BAR: 'statusBar' as const
33+
STATUS_BAR: 'statusBar' as const,
34+
NOIR_COMPILER: 'noir-compiler' as const
3435
}
3536

3637
// Common action constants used across multiple categories

libs/remix-api/src/lib/plugins/matomo/events/tools-events.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ export interface SolidityUMLGenEvent extends MatomoEventBase {
198198

199199

200200
/**
201+
*
201202
* Circuit Compiler Events - Type-safe builders
202203
*/
203204
export interface CircuitCompilerEvent extends MatomoEventBase {
@@ -219,9 +220,10 @@ export interface CircuitCompilerEvent extends MatomoEventBase {
219220
export interface NoirCompilerEvent extends MatomoEventBase {
220221
category: 'noir-compiler';
221222
action:
222-
| 'compile'
223223
| 'template'
224-
| 'error';
224+
| 'compile'
225+
| 'generate_proof'
226+
| 'view_file';
225227
}
226228

227229

@@ -278,5 +280,4 @@ export interface ScriptRunnerPluginEvent extends MatomoEventBase {
278280
| 'error_reloadScriptRunnerConfig'
279281
| 'executeScript'
280282
| 'configChanged';
281-
}
282-
283+
}

0 commit comments

Comments
 (0)