From 9c4229ed8d8b8bf3aa122ba3252f72c00f1dda47 Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 6 Dec 2023 10:17:12 +0100 Subject: [PATCH 1/4] enable cookies on optin --- apps/remix-ide/src/assets/js/loader.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/remix-ide/src/assets/js/loader.js b/apps/remix-ide/src/assets/js/loader.js index 8db5546da5e..ed718e63121 100644 --- a/apps/remix-ide/src/assets/js/loader.js +++ b/apps/remix-ide/src/assets/js/loader.js @@ -17,8 +17,11 @@ 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']); + // OR require user cookie consent before storing any cookies + _paq.push(['requireCookieConsent']); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); _paq.push(['enableHeartBeatTimer']); @@ -38,17 +41,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 From b98b5258ef82370255ddca8eb91fcd39b2f0d866 Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 6 Dec 2023 10:46:49 +0100 Subject: [PATCH 2/4] updating from settings as well --- apps/remix-ide/src/app/tabs/settings-tab.tsx | 13 +++++++++++++ .../src/lib/remix-app/components/modals/matomo.tsx | 8 ++++++++ 2 files changed, 21 insertions(+) diff --git a/apps/remix-ide/src/app/tabs/settings-tab.tsx b/apps/remix-ide/src/app/tabs/settings-tab.tsx index 8ba30c549c6..f1f546deb2a 100644 --- a/apps/remix-ide/src/app/tabs/settings-tab.tsx +++ b/apps/remix-ide/src/app/tabs/settings-tab.tsx @@ -85,6 +85,19 @@ 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']); + // OR revoke cookie consent + _paq.push(['forgetCookieConsentGiven']); + } else { + _paq.push(['forgetUserOptOut']) + // user has given consent to process their data + _paq.push(['setConsentGiven']); + // OR user has given consent to store and use cookies + _paq.push(['setCookieConsentGiven']); + } this.dispatch({ ...this }) 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..93974f15b3b 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,19 @@ const MatomoDialog = (props) => { const declineModal = async () => { settings.updateMatomoAnalyticsChoice(false) _paq.push(['optUserOut']) + // revoke tracking consent + _paq.push(['forgetConsentGiven']); + // OR revoke cookie consent + _paq.push(['forgetCookieConsentGiven']); setVisible(false) } const handleModalOkClick = async () => { _paq.push(['forgetUserOptOut']) + // user has given consent to process their data + _paq.push(['setConsentGiven']); + // OR user has given consent to store and use cookies + _paq.push(['setCookieConsentGiven']); settings.updateMatomoAnalyticsChoice(true) setVisible(false) } From 075475df19665301bca9a446d4cb43e0c6e89af8 Mon Sep 17 00:00:00 2001 From: lianahus Date: Wed, 6 Dec 2023 11:30:07 +0100 Subject: [PATCH 3/4] build fix --- apps/remix-ide/src/app/tabs/settings-tab.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/remix-ide/src/app/tabs/settings-tab.tsx b/apps/remix-ide/src/app/tabs/settings-tab.tsx index f1f546deb2a..a95bf5f0cc0 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', From 111f5e32bc8f0fec4dcf88f6a132de57a346d9b6 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 6 Dec 2023 13:14:28 +0100 Subject: [PATCH 4/4] update matomo config --- apps/remix-ide/src/app/tabs/settings-tab.tsx | 4 ---- apps/remix-ide/src/assets/js/loader.js | 7 +++++-- .../app/src/lib/remix-app/components/modals/matomo.tsx | 4 ---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/settings-tab.tsx b/apps/remix-ide/src/app/tabs/settings-tab.tsx index a95bf5f0cc0..3950e72a470 100644 --- a/apps/remix-ide/src/app/tabs/settings-tab.tsx +++ b/apps/remix-ide/src/app/tabs/settings-tab.tsx @@ -95,14 +95,10 @@ module.exports = class SettingsTab extends ViewPlugin { _paq.push(['optUserOut']) // revoke tracking consent _paq.push(['forgetConsentGiven']); - // OR revoke cookie consent - _paq.push(['forgetCookieConsentGiven']); } else { _paq.push(['forgetUserOptOut']) // user has given consent to process their data _paq.push(['setConsentGiven']); - // OR user has given consent to store and use cookies - _paq.push(['setCookieConsentGiven']); } this.dispatch({ ...this diff --git a/apps/remix-ide/src/assets/js/loader.js b/apps/remix-ide/src/assets/js/loader.js index ed718e63121..5938aeaf9ce 100644 --- a/apps/remix-ide/src/assets/js/loader.js +++ b/apps/remix-ide/src/assets/js/loader.js @@ -20,14 +20,17 @@ if (domains[window.location.hostname]) { _paq.push(['enableJSErrorTracking']); // require user tracking consent before processing data _paq.push(['requireConsent']); - // OR require user cookie consent before storing any cookies - _paq.push(['requireCookieConsent']); _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/"; 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 93974f15b3b..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 @@ -59,8 +59,6 @@ const MatomoDialog = (props) => { _paq.push(['optUserOut']) // revoke tracking consent _paq.push(['forgetConsentGiven']); - // OR revoke cookie consent - _paq.push(['forgetCookieConsentGiven']); setVisible(false) } @@ -68,8 +66,6 @@ const MatomoDialog = (props) => { _paq.push(['forgetUserOptOut']) // user has given consent to process their data _paq.push(['setConsentGiven']); - // OR user has given consent to store and use cookies - _paq.push(['setCookieConsentGiven']); settings.updateMatomoAnalyticsChoice(true) setVisible(false) }