Skip to content

Commit 8d3aed1

Browse files
committed
added matomo in right side panel
1 parent 5e340cb commit 8d3aed1

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { PluginRecord, 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+
import { trackMatomoEvent } from '@remix-api'
89

910
const rightSidePanel = {
1011
name: 'rightSidePanel',
@@ -61,6 +62,7 @@ export class RightSidePanel extends AbstractPanel {
6162
if (this.isHidden) {
6263
const pinnedPanel = document.querySelector('#right-side-panel')
6364
pinnedPanel?.classList.add('d-none')
65+
trackMatomoEvent(this, { category: 'topbar', action: 'rightSidePanel', name: 'hiddenOnLoad', isClick: false })
6466
this.emit('rightSidePanelHidden')
6567
this.events.emit('rightSidePanelHidden')
6668
}
@@ -76,6 +78,7 @@ export class RightSidePanel extends AbstractPanel {
7678
window.localStorage.setItem('panelStates', JSON.stringify(panelStates))
7779
const pinnedPanel = document.querySelector('#right-side-panel')
7880
pinnedPanel?.classList.add('d-none')
81+
trackMatomoEvent(this, { category: 'topbar', action: 'rightSidePanel', name: 'InitializeDefaultAndHiddenOnLoad', isClick: false })
7982
this.emit('rightSidePanelHidden')
8083
this.events.emit('rightSidePanelHidden')
8184
}
@@ -126,7 +129,7 @@ export class RightSidePanel extends AbstractPanel {
126129
this.events.emit('rightSidePanelShown')
127130
this.emit('rightSidePanelShown')
128131
}
129-
132+
trackMatomoEvent(this, { category: 'topbar', action: 'rightSidePanel', name: 'shownOnPluginPinned', isClick: false })
130133
// Save pinned plugin profile to panelStates
131134
const updatedPanelStates = JSON.parse(window.localStorage.getItem('panelStates') || '{}')
132135
updatedPanelStates.rightSidePanel = {
@@ -156,6 +159,7 @@ export class RightSidePanel extends AbstractPanel {
156159
pluginProfile: null
157160
}
158161
window.localStorage.setItem('panelStates', JSON.stringify(panelStates))
162+
trackMatomoEvent(this, { category: 'topbar', action: 'rightSidePanel', name: 'hiddenOnPluginUnpinned', isClick: false })
159163
this.renderComponent()
160164
this.events.emit('unPinnedPlugin', profile)
161165
this.emit('unPinnedPlugin', profile)
@@ -180,6 +184,7 @@ export class RightSidePanel extends AbstractPanel {
180184
// Ensure the panel is hidden and toggle icon is off
181185
if (!this.isHidden) {
182186
this.isHidden = true
187+
trackMatomoEvent(this, { category: 'topbar', action: 'rightSidePanel', name: 'hiddenOnToggleIconClickAndNoPluginPinned', isClick: false })
183188
pinnedPanel?.classList.add('d-none')
184189
this.emit('rightSidePanelHidden')
185190
this.events.emit('rightSidePanelHidden')
@@ -196,12 +201,14 @@ export class RightSidePanel extends AbstractPanel {
196201
if (this.isHidden) {
197202
this.isHidden = false
198203
pinnedPanel?.classList.remove('d-none')
204+
trackMatomoEvent(this, { category: 'topbar', action: 'rightSidePanel', name: 'shownOnToggleIconClick', isClick: false })
199205
this.emit('rightSidePanelShown')
200206
this.events.emit('rightSidePanelShown')
201207
} else {
202208
this.isHidden = true
203209
this.hiddenPlugin = pluginProfile
204210
pinnedPanel?.classList.add('d-none')
211+
trackMatomoEvent(this, { category: 'topbar', action: 'rightSidePanel', name: 'hiddenOnToggleIconClick', isClick: false })
205212
this.emit('rightSidePanelHidden')
206213
this.events.emit('rightSidePanelHidden')
207214
}
@@ -225,6 +232,7 @@ export class RightSidePanel extends AbstractPanel {
225232
this.isHidden = false
226233
this.hiddenPlugin = null
227234
pinnedPanel?.classList.remove('d-none')
235+
trackMatomoEvent(this, { category: 'topbar', action: 'rightSidePanel', name: 'shownOnVerticalIconClick', isClick: false })
228236
this.emit('rightSidePanelShown')
229237
this.events.emit('rightSidePanelShown')
230238

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ export interface TopbarEvent extends MatomoEventBase {
2727
category: 'topbar';
2828
action:
2929
| 'GIT'
30-
| 'panelShown'
31-
| 'panelHidden'
30+
| 'leftSidePanel'
31+
| 'terminalPanel'
32+
| 'rightSidePanel'
3233
| 'header';
3334
}
3435

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

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,31 +107,31 @@ export function RemixUiTopbar() {
107107
// Listen to left side panel events
108108
plugin.on('sidePanel', 'leftSidePanelHidden', () => {
109109
setLeftPanelHidden(true)
110-
trackMatomoEvent({ category: 'topbar', action: 'panelHidden', name: 'leftSidePanel', isClick: true })
110+
trackMatomoEvent({ category: 'topbar', action: 'leftSidePanel', name: 'panelHidden', isClick: false })
111111
})
112112
plugin.on('sidePanel', 'leftSidePanelShown', () => {
113113
setLeftPanelHidden(false)
114-
trackMatomoEvent({ category: 'topbar', action: 'panelShown', name: 'leftSidePanel', isClick: true })
114+
trackMatomoEvent({ category: 'topbar', action: 'leftSidePanel', name: 'panelShown', isClick: false })
115115
})
116116

117117
// Listen to terminal panel events
118118
plugin.on('terminal', 'terminalPanelHidden', () => {
119119
setBottomPanelHidden(true)
120-
trackMatomoEvent({ category: 'topbar', action: 'panelHidden', name: 'terminalPanel', isClick: true })
120+
trackMatomoEvent({ category: 'topbar', action: 'terminalPanel', name: 'panelHidden', isClick: false })
121121
})
122122
plugin.on('terminal', 'terminalPanelShown', () => {
123123
setBottomPanelHidden(false)
124-
trackMatomoEvent({ category: 'topbar', action: 'panelShown', name: 'terminalPanel', isClick: true })
124+
trackMatomoEvent({ category: 'topbar', action: 'terminalPanel', name: 'panelShown', isClick: false })
125125
})
126126

127127
// Listen to right side panel events
128128
plugin.on('rightSidePanel', 'rightSidePanelHidden', () => {
129129
setRightPanelHidden(true)
130-
trackMatomoEvent({ category: 'topbar', action: 'panelHidden', name: 'rightSidePanel', isClick: true })
130+
trackMatomoEvent({ category: 'topbar', action: 'rightSidePanel', name: 'panelHidden', isClick: false })
131131
})
132132
plugin.on('rightSidePanel', 'rightSidePanelShown', () => {
133133
setRightPanelHidden(false)
134-
trackMatomoEvent({ category: 'topbar', action: 'panelShown', name: 'rightSidePanel', isClick: true })
134+
trackMatomoEvent({ category: 'topbar', action: 'rightSidePanel', name: 'panelShown', isClick: false })
135135
})
136136

137137
// Initialize panel states from localStorage
@@ -597,21 +597,33 @@ export function RemixUiTopbar() {
597597
<div
598598
className={`codicon codicon-layout-sidebar-left${leftPanelHidden ? '-off' : ''} fs-5`}
599599
data-id="toggleLeftSidePanelIcon"
600-
onClick={() => plugin.call('sidePanel', 'togglePanel')}
600+
onClick={() => {
601+
trackMatomoEvent({ category: 'topbar', action: 'leftSidePanel', name: 'toggleIconClicked', isClick: true })
602+
plugin.call('sidePanel', 'togglePanel')
603+
}
604+
}
601605
></div>
602606
</CustomTooltip>
603607
<CustomTooltip placement="bottom-start" tooltipText={`Toggle Bottom Panel`}>
604608
<div
605609
className={`codicon codicon-layout-panel${bottomPanelHidden ? '-off' : ''} fs-5`}
606610
data-id="toggleBottomPanelIcon"
607-
onClick={() => plugin.call('terminal', 'togglePanel')}
611+
onClick={() => {
612+
trackMatomoEvent({ category: 'topbar', action: 'terminalPanel', name: 'toggleIconClicked', isClick: true })
613+
plugin.call('terminal', 'togglePanel')
614+
}
615+
}
608616
></div>
609617
</CustomTooltip>
610618
<CustomTooltip placement="bottom-start" tooltipText={`Toggle Right Side Panel`}>
611619
<div
612620
className={`codicon codicon-layout-sidebar-right${rightPanelHidden ? '-off' : ''} fs-5`}
613621
data-id="toggleRightSidePanelIcon"
614-
onClick={() => plugin.call('rightSidePanel', 'togglePanel')}
622+
onClick={() => {
623+
trackMatomoEvent({ category: 'topbar', action: 'rightSidePanel', name: 'toggleIconClicked', isClick: true })
624+
plugin.call('rightSidePanel', 'togglePanel')
625+
}
626+
}
615627
></div>
616628
</CustomTooltip>
617629
</div>

0 commit comments

Comments
 (0)