Skip to content

Commit 243851b

Browse files
committed
matomo perf analytics
1 parent bbeed1b commit 243851b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

apps/remix-ide/src/app/tabs/settings-tab.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export default class SettingsTab extends ViewPlugin {
3636
}
3737
element: HTMLDivElement
3838
public useMatomoAnalytics: any
39+
public useMatomoPerfAnalytics: any
3940
public useCopilot: any
4041
dispatch: React.Dispatch<any> = () => {}
4142
constructor(config, editor) {
@@ -52,6 +53,7 @@ export default class SettingsTab extends ViewPlugin {
5253
this.element = document.createElement('div')
5354
this.element.setAttribute('id', 'settingsTab')
5455
this.useMatomoAnalytics = null
56+
this.useMatomoPerfAnalytics = null
5557
this.useCopilot = this.get('settings/copilot/suggest/activate')
5658
}
5759

@@ -123,4 +125,21 @@ export default class SettingsTab extends ViewPlugin {
123125
...this
124126
})
125127
}
128+
129+
updateMatomoPerfAnalyticsChoice(isChecked) {
130+
this.config.set('settings/matomo-perf-analytics', isChecked)
131+
// set timestamp to local storage to track when the user has given consent
132+
localStorage.setItem('matomo-perf-analytics-consent', Date.now().toString())
133+
this.useMatomoPerfAnalytics = isChecked
134+
if (!isChecked) {
135+
// revoke tracking consent , need to be updated
136+
_paq.push(['forgetConsentGiven']);
137+
} else {
138+
// user has given consent to process their data, need to be updated
139+
_paq.push(['setConsentGiven']);
140+
}
141+
this.dispatch({
142+
...this
143+
})
144+
}
126145
}

libs/remix-ui/app/src/lib/remix-app/components/modals/managePreferences.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ const ManagePreferencesDialog = (props: ManagePreferencesDialogProps) => {
132132

133133
const savePreferences = async () => {
134134
settings.updateMatomoAnalyticsChoice(true) // Always true for matomo Anonymous analytics
135+
settings.updateMatomoPerfAnalyticsChoice(switcherState.current.matPerfSwitch) // Enable/Disable Matomo Performance analytics
135136
settings.updateCopilotChoice(switcherState.current.remixAISwitch) // Enable/Disable RemixAI copilot
136137
}
137138

0 commit comments

Comments
 (0)