Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matomo config #4306

Merged
merged 4 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions apps/remix-ide/src/app/tabs/settings-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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
})
Expand Down
14 changes: 10 additions & 4 deletions apps/remix-ide/src/assets/js/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is you have to call setConsentGiven I think.

_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/";
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
Loading