From f111b189c2d6c0578193ff574376a92145b480f4 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 3 Jan 2024 16:10:40 +0100 Subject: [PATCH] fix matomo --- apps/remix-ide/src/app/tabs/settings-tab.tsx | 2 -- apps/remix-ide/src/assets/js/loader.js | 7 ++----- .../app/src/lib/remix-app/components/modals/matomo.tsx | 2 -- libs/remix-ui/app/src/lib/remix-app/remix-app.tsx | 2 +- libs/remix-ui/settings/src/lib/settingsAction.ts | 6 ++++-- 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/settings-tab.tsx b/apps/remix-ide/src/app/tabs/settings-tab.tsx index 3950e72a47..63a2b89979 100644 --- a/apps/remix-ide/src/app/tabs/settings-tab.tsx +++ b/apps/remix-ide/src/app/tabs/settings-tab.tsx @@ -92,11 +92,9 @@ module.exports = class SettingsTab extends ViewPlugin { this.config.set('settings/matomo-analytics', isChecked) this.useMatomoAnalytics = isChecked if (!isChecked) { - _paq.push(['optUserOut']) // revoke tracking consent _paq.push(['forgetConsentGiven']); } else { - _paq.push(['forgetUserOptOut']) // user has given consent to process their data _paq.push(['setConsentGiven']); } diff --git a/apps/remix-ide/src/assets/js/loader.js b/apps/remix-ide/src/assets/js/loader.js index 5938aeaf9c..4abdfc6526 100644 --- a/apps/remix-ide/src/assets/js/loader.js +++ b/apps/remix-ide/src/assets/js/loader.js @@ -18,17 +18,14 @@ if (domains[window.location.hostname]) { _paq.push(["setExcludedQueryParams", ["code","gist"]]); _paq.push(["setExcludedReferrers", ["etherscan.io"]]); _paq.push(['enableJSErrorTracking']); - // require user tracking consent before processing data - _paq.push(['requireConsent']); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); _paq.push(['enableHeartBeatTimer']); if (!window.localStorage.getItem('config-v0.8:.remix.config') || (window.localStorage.getItem('config-v0.8:.remix.config') && !window.localStorage.getItem('config-v0.8:.remix.config').includes('settings/matomo-analytics'))) { - _paq.push(['optUserOut']) - + // require user tracking consent before processing data + _paq.push(['requireConsent']); } else { - _paq.push(['forgetUserOptOut']) // user has given consent to process their data _paq.push(['setConsentGiven']) } diff --git a/libs/remix-ui/app/src/lib/remix-app/components/modals/matomo.tsx b/libs/remix-ui/app/src/lib/remix-app/components/modals/matomo.tsx index 59391d1e09..8148602796 100644 --- a/libs/remix-ui/app/src/lib/remix-app/components/modals/matomo.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/components/modals/matomo.tsx @@ -61,14 +61,12 @@ const MatomoDialog = (props: MatomoDialogProps) => { const declineModal = async () => { settings.updateMatomoAnalyticsChoice(false) - _paq.push(['optUserOut']) // revoke tracking consent _paq.push(['forgetConsentGiven']); setVisible(false) } const handleModalOkClick = async () => { - _paq.push(['forgetUserOptOut']) // user has given consent to process their data _paq.push(['setConsentGiven']); settings.updateMatomoAnalyticsChoice(true) diff --git a/libs/remix-ui/app/src/lib/remix-app/remix-app.tsx b/libs/remix-ui/app/src/lib/remix-app/remix-app.tsx index aed01704a0..d646f75e49 100644 --- a/libs/remix-ui/app/src/lib/remix-app/remix-app.tsx +++ b/libs/remix-ui/app/src/lib/remix-app/remix-app.tsx @@ -123,7 +123,7 @@ const RemixApp = (props: IRemixAppUi) => { break } case UsageTypes.Advance: { - _paq.push(['trackEvent', 'enterDialog', 'usageType', 'tutor']) + _paq.push(['trackEvent', 'enterDialog', 'usageType', 'advanced']) break } case UsageTypes.Prototyper: { diff --git a/libs/remix-ui/settings/src/lib/settingsAction.ts b/libs/remix-ui/settings/src/lib/settingsAction.ts index cc5b096ee0..6e59d25ffb 100644 --- a/libs/remix-ui/settings/src/lib/settingsAction.ts +++ b/libs/remix-ui/settings/src/lib/settingsAction.ts @@ -43,9 +43,11 @@ export const useMatomoAnalytics = (config, checked, dispatch) => { config.set('settings/matomo-analytics', checked) dispatch({ type: 'useMatomoAnalytics', payload: { isChecked: checked, textClass: checked ? textDark : textSecondary } }) if (checked) { - _paq.push(['forgetUserOptOut']) + // user has given consent to process their data + _paq.push(['setConsentGiven']); } else { - _paq.push(['optUserOut']) + // revoke tracking consent + _paq.push(['forgetConsentGiven']); } }