diff --git a/apps/remix-ide/src/app/tabs/settings-tab.tsx b/apps/remix-ide/src/app/tabs/settings-tab.tsx index 8ba30c549c6..3950e72a470 100644 --- a/apps/remix-ide/src/app/tabs/settings-tab.tsx +++ b/apps/remix-ide/src/app/tabs/settings-tab.tsx @@ -5,6 +5,12 @@ import * as packageJson from '../../../../../package.json' import {RemixUiSettings} from '@remix-ui/settings' //eslint-disable-line import Registry from '../state/registry' import {PluginViewWrapper} from '@remix-ui/helper' +declare global { + interface Window { + _paq: any + } +} +const _paq = (window._paq = window._paq || []) const profile = { name: 'settings', @@ -85,6 +91,15 @@ module.exports = class SettingsTab extends ViewPlugin { updateMatomoAnalyticsChoice(isChecked) { 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']); + } this.dispatch({ ...this }) diff --git a/apps/remix-ide/src/assets/js/loader.js b/apps/remix-ide/src/assets/js/loader.js index 8db5546da5e..5938aeaf9ce 100644 --- a/apps/remix-ide/src/assets/js/loader.js +++ b/apps/remix-ide/src/assets/js/loader.js @@ -17,14 +17,20 @@ if (domains[window.location.hostname]) { /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(["setExcludedQueryParams", ["code","gist"]]); _paq.push(["setExcludedReferrers", ["etherscan.io"]]); - _paq.push(['disableCookies']); _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']) + + } else { + _paq.push(['forgetUserOptOut']) + // user has given consent to process their data + _paq.push(['setConsentGiven']) } (function () { var u = "https://ethereumfoundation.matomo.cloud/"; @@ -38,17 +44,17 @@ if (domains[window.location.hostname]) { function isElectron() { // Renderer process if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') { - return true + return true } // Main process if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) { - return true + return true } // Detect the user agent when the `nodeIntegration` option is set to false if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) { - return true + return true } return false 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 c4637cb85d8..b1fb029b775 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 @@ -57,11 +57,15 @@ const MatomoDialog = (props) => { 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) setVisible(false) }