jonkoops / matomo-tracker

Stand alone library for using matamo tracking in frontend projects
Mozilla Public License 2.0
142 stars 62 forks source link

Globally enable / disable tracking after initialization within App #478

Open kombasltd opened 3 years ago

kombasltd commented 3 years ago

Is your feature request related to a problem? Please describe. In the context of the EU Cookie Directive, tracking is only permitted with the consent of the website visitor. In a cookie dialog, the visitor agrees or refuses to the setting of cookies. Matomo tracking can only be activated with consent.

Describe the solution you'd like After first initialization of Matomo in index.tsx (as wrapper around die App) there shoud be a way to disable / enable Matomo tracking from anywhere within the app.

Something like

const { disableTracking } = useMatomo();

Describe alternatives you've considered Enabling / Disabling all tracking-events manually in a component, based on a flag.

Additional context

mnogueras commented 3 years ago

I'm also running on this problem. That would be a great feature. The cookie should not be set before the user gives the consent.

Sandstedt commented 3 years ago

I'm not a lawyer buuuut, if we don't collect any personal information, there is no need for a consent right? You're allowed to set functional cookies without a consent.

opsidao commented 2 years ago

I have proposed a possible solution that allows to delay loading the matomo library on https://github.com/Amsterdam/matomo-tracker/pull/736, would love to hear some opinions there.

kuzdogan commented 2 years ago

It seems we don't need to show a pop-up? https://matomo.org/gdpr-analytics/

opsidao commented 2 years ago

@kuzdogan as mentioned in the post you link, to ensure GDPR compliance [snip] Users can opt-out of all tracking, which they can't with the current implementation of this library.

I understand that the French authorities have allowed Matomo to work without user consent, but given that GDPR applies to quite a few more countries than France, I think we still need to be able to disable/enable it on demand.

Beyond that, in my opinion, it's not just about legislation, it's also about giving users of the library options and allowing them to make the decissions on their own.