Skip to content

Commit 0c9a196

Browse files
committed
add matomo tracking to noir-compiler
1 parent 46080d4 commit 0c9a196

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
@@ -203,6 +203,7 @@ export interface SolidityUMLGenEvent extends MatomoEventBase {
203203

204204

205205
/**
206+
*
206207
* Circuit Compiler Events - Type-safe builders
207208
*/
208209
export interface CircuitCompilerEvent extends MatomoEventBase {
@@ -224,9 +225,10 @@ export interface CircuitCompilerEvent extends MatomoEventBase {
224225
export interface NoirCompilerEvent extends MatomoEventBase {
225226
category: 'noir-compiler';
226227
action:
227-
| 'compile'
228228
| 'template'
229-
| 'error';
229+
| 'compile'
230+
| 'generate_proof'
231+
| 'view_file';
230232
}
231233

232234

@@ -283,5 +285,4 @@ export interface ScriptRunnerPluginEvent extends MatomoEventBase {
283285
| 'error_reloadScriptRunnerConfig'
284286
| 'executeScript'
285287
| 'configChanged';
286-
}
287-
288+
}

0 commit comments

Comments
 (0)