Skip to content

Commit b178b32

Browse files
committed
tracking in side panel & terminal
1 parent 843fcd7 commit b178b32

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

apps/remix-ide/src/app/components/side-panel.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { RemixPluginPanel } from '@remix-ui/panel'
55
import packageJson from '../../../../../package.json'
66
import { RemixUIPanelHeader } from '@remix-ui/panel'
77
import { PluginViewWrapper } from '@remix-ui/helper'
8-
// const csjs = require('csjs-inject')
8+
import { trackMatomoEvent } from '@remix-api'
99

1010
const sidePanel = {
1111
name: 'sidePanel',
@@ -39,6 +39,7 @@ export class SidePanel extends AbstractPanel {
3939
if (this.isHidden) {
4040
const sidePanel = document.querySelector('#side-panel')
4141
sidePanel?.classList.add('d-none')
42+
trackMatomoEvent(this, { category: 'topbar', action: 'leftSidePanel', name: 'hiddenOnLoad', isClick: false })
4243
}
4344
} else {
4445
// Initialize with default state if not found
@@ -69,6 +70,7 @@ export class SidePanel extends AbstractPanel {
6970
panelStates.leftSidePanel.pluginProfile = this.plugins[name]?.profile
7071
window.localStorage.setItem('panelStates', JSON.stringify(panelStates))
7172

73+
trackMatomoEvent(this, { category: 'topbar', action: 'leftSidePanel', name: 'shownOnVerticalIconClick', isClick: false })
7274
this.showContent(name)
7375
this.emit('leftSidePanelShown')
7476
this.events.emit('leftSidePanelShown')
@@ -92,6 +94,7 @@ export class SidePanel extends AbstractPanel {
9294
}
9395
window.localStorage.setItem('panelStates', JSON.stringify(panelStates))
9496

97+
trackMatomoEvent(this, { category: 'topbar', action: 'leftSidePanel', name: 'hiddenOnVerticalIconClick', isClick: false })
9598
// Emit explicit panel state events for proper synchronization
9699
this.emit('leftSidePanelHidden')
97100
this.events.emit('leftSidePanelHidden')
@@ -134,6 +137,7 @@ export class SidePanel extends AbstractPanel {
134137
panelStates.leftSidePanel.pluginProfile = this.plugins[name]?.profile
135138
window.localStorage.setItem('panelStates', JSON.stringify(panelStates))
136139

140+
trackMatomoEvent(this, { category: 'topbar', action: 'leftSidePanel', name: 'shownOnForceShowContent', isClick: false })
137141
this.showContent(name)
138142
this.emit('leftSidePanelShown')
139143
this.events.emit('leftSidePanelShown')
@@ -207,11 +211,13 @@ export class SidePanel extends AbstractPanel {
207211
if (this.isHidden) {
208212
this.isHidden = false
209213
sidePanel?.classList.remove('d-none')
214+
trackMatomoEvent(this, { category: 'topbar', action: 'leftSidePanel', name: 'shownOnToggleIconClick', isClick: false })
210215
this.emit('leftSidePanelShown')
211216
this.events.emit('leftSidePanelShown')
212217
} else {
213218
this.isHidden = true
214219
sidePanel?.classList.add('d-none')
220+
trackMatomoEvent(this, { category: 'topbar', action: 'leftSidePanel', name: 'hiddenOnToggleIconClick', isClick: false })
215221
this.emit('leftSidePanelHidden')
216222
this.events.emit('leftSidePanelHidden')
217223
}

apps/remix-ide/src/app/panels/terminal.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import EventManager from '../../lib/events'
1010

1111
import { CompilerImports } from '@remix-project/core-plugin' // eslint-disable-line
1212
import { RemixUiXterminals } from '@remix-ui/xterm'
13+
import { trackMatomoEvent } from '@remix-api'
1314

1415
const KONSOLES = []
1516

@@ -125,6 +126,7 @@ export default class Terminal extends Plugin {
125126
if (this.isHidden) {
126127
const terminalPanel = document.querySelector('.terminal-wrap')
127128
terminalPanel?.classList.add('d-none')
129+
trackMatomoEvent(this, { category: 'topbar', action: 'terminalPanel', name: 'hiddenOnLoad', isClick: false })
128130
}
129131
} else {
130132
// Initialize with default state if not found
@@ -164,6 +166,7 @@ export default class Terminal extends Plugin {
164166
const terminalPanel = document.querySelector('.terminal-wrap')
165167
this.isHidden = false
166168
terminalPanel?.classList.remove('d-none')
169+
trackMatomoEvent(this, { category: 'topbar', action: 'terminalPanel', name: 'shownOnLog', isClick: false })
167170
this.emit('terminalPanelShown')
168171

169172
// Persist the state
@@ -180,10 +183,12 @@ export default class Terminal extends Plugin {
180183
if (this.isHidden) {
181184
this.isHidden = false
182185
terminalPanel?.classList.remove('d-none')
186+
trackMatomoEvent(this, { category: 'topbar', action: 'terminalPanel', name: 'shownOnToggleIconClick', isClick: false })
183187
this.emit('terminalPanelShown')
184188
} else {
185189
this.isHidden = true
186190
terminalPanel?.classList.add('d-none')
191+
trackMatomoEvent(this, { category: 'topbar', action: 'terminalPanel', name: 'hiddenOnToggleIconClick', isClick: false })
187192
this.emit('terminalPanelHidden')
188193
}
189194
// Persist the hidden state and plugin profile to panelStates

0 commit comments

Comments
 (0)