Skip to content

Commit 17ddb3c

Browse files
authored
Merge pull request #6478 from remix-project-org/matomo-cleanup
Correct workspace matomo events
2 parents 82f619e + 07941ac commit 17ddb3c

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export interface WorkspaceEvent extends MatomoEventBase {
2424
category: 'Workspace';
2525
action:
2626
| 'switchWorkspace'
27-
| 'GIT'
28-
| 'createWorkspace';
27+
| 'template'
28+
| 'GIT';
2929
}
3030

3131
export interface StorageEvent extends MatomoEventBase {

libs/remix-ui/top-bar/src/lib/remix-ui-topbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ export function RemixUiTopbar() {
292292

293293
const loginWithGitHub = async () => {
294294
global.plugin.call('dgit', 'login')
295-
trackMatomoEvent({ category: 'topbar', action: 'header', name: 'Settings', isClick: true })
295+
trackMatomoEvent({ category: 'topbar', action: 'GIT', name: 'login', isClick: true })
296296
}
297297

298298
const logOutOfGithub = async () => {

libs/remix-ui/workspace/src/lib/actions/workspace.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,10 @@ export const populateWorkspace = async (
239239
if (workspaceTemplateName === 'semaphore' || workspaceTemplateName === 'hashchecker' || workspaceTemplateName === 'rln') {
240240
const isCircomActive = await plugin.call('manager', 'isActive', 'circuit-compiler')
241241
if (!isCircomActive) await plugin.call('manager', 'activatePlugin', 'circuit-compiler')
242-
await trackMatomoEventAsync(plugin, { category: 'compiler', action: 'compiled', name: workspaceTemplateName, isClick: false })
243242
}
244243
if (workspaceTemplateName === 'multNr' || workspaceTemplateName === 'stealthDropNr') {
245244
const isNoirActive = await plugin.call('manager', 'isActive', 'noir-compiler')
246245
if (!isNoirActive) await plugin.call('manager', 'activatePlugin', 'noir-compiler')
247-
await trackMatomoEventAsync(plugin, { category: 'compiler', action: 'compiled', name: workspaceTemplateName, isClick: false })
248246
}
249247
}
250248

@@ -301,15 +299,15 @@ export const loadWorkspacePreset = async (template: WorkspaceTemplate = 'remixDe
301299
let content
302300

303301
if (params.code) {
304-
await trackMatomoEventAsync(plugin, { category: 'Workspace', action: 'switchWorkspace', name: 'code-template-code-param', isClick: false })
302+
await trackMatomoEventAsync(plugin, { category: 'Workspace', action: 'template', name: 'code-template-code-param', isClick: false })
305303
const hashed = bytesToHex(hash.keccakFromString(params.code))
306304

307305
path = 'contract-' + hashed.replace('0x', '').substring(0, 10) + (params.language && params.language.toLowerCase() === 'yul' ? '.yul' : '.sol')
308306
content = decodePercentEscapedBase64(params.code)
309307
await workspaceProvider.set(path, content)
310308
}
311309
if (params.shareCode) {
312-
await trackMatomoEventAsync(plugin, { category: 'Workspace', action: 'switchWorkspace', name: 'code-template-shareCode-param', isClick: false })
310+
await trackMatomoEventAsync(plugin, { category: 'Workspace', action: 'template', name: 'code-template-shareCode-param', isClick: false })
313311
const host = '127.0.0.1'
314312
const port = 5001
315313
const protocol = 'http'
@@ -334,7 +332,7 @@ export const loadWorkspacePreset = async (template: WorkspaceTemplate = 'remixDe
334332
await workspaceProvider.set(path, content)
335333
}
336334
if (params.url) {
337-
await trackMatomoEventAsync(plugin, { category: 'Workspace', action: 'switchWorkspace', name: 'code-template-url-param', isClick: false })
335+
await trackMatomoEventAsync(plugin, { category: 'Workspace', action: 'template', name: 'code-template-url-param', isClick: false })
338336
const data = await plugin.call('contentImport', 'resolve', params.url)
339337
path = data.cleanUrl
340338
content = data.content
@@ -358,7 +356,7 @@ export const loadWorkspacePreset = async (template: WorkspaceTemplate = 'remixDe
358356
}
359357
if (params.ghfolder) {
360358
try {
361-
await trackMatomoEventAsync(plugin, { category: 'Workspace', action: 'switchWorkspace', name: 'code-template-ghfolder-param', isClick: false })
359+
await trackMatomoEventAsync(plugin, { category: 'Workspace', action: 'template', name: 'code-template-ghfolder-param', isClick: false })
362360
const files = await plugin.call('contentImport', 'resolveGithubFolder', params.ghfolder)
363361
for (const [path, content] of Object.entries(files)) {
364362
await workspaceProvider.set(path, content)
@@ -377,7 +375,7 @@ export const loadWorkspacePreset = async (template: WorkspaceTemplate = 'remixDe
377375
case 'gist-template':
378376
// creates a new workspace gist-sample and get the file from gist
379377
try {
380-
await trackMatomoEventAsync(plugin, { category: 'Workspace', action: 'switchWorkspace', name: 'gist-template', isClick: false })
378+
await trackMatomoEventAsync(plugin, { category: 'Workspace', action: 'template', name: 'gist-template', isClick: false })
381379
const gistId = params.gist
382380
const response: AxiosResponse = await axios.get(`https://api.github.com/gists/${gistId}`)
383381
const data = response.data as { files: any }
@@ -440,7 +438,7 @@ export const loadWorkspacePreset = async (template: WorkspaceTemplate = 'remixDe
440438
const templateList = Object.keys(templateWithContent)
441439
if (!templateList.includes(template)) break
442440

443-
await trackMatomoEventAsync(plugin, { category: 'Workspace', action: 'switchWorkspace', name: template, isClick: false })
441+
await trackMatomoEventAsync(plugin, { category: 'Workspace', action: 'template', name: template, isClick: false })
444442
// @ts-ignore
445443
const files = await templateWithContent[template](opts, plugin)
446444
for (const file in files) {

0 commit comments

Comments
 (0)