AmazingDreams / vue-matomo

Vue plugin for Matomo Analytics
MIT License
282 stars 61 forks source link

rememberConsentGiven() does not set setConsentGiven() #78

Closed helllicht closed 4 years ago

helllicht commented 4 years ago

Hi,

from the official API of Matomo:

https://developer.matomo.org/api-reference/tracking-javascript#managing-consent

rememberConsentGiven( hoursToExpire ) - Mark that the current user has consented, and remembers this consent through a browser cookie. The next time the user visits the site, Matomo will remember that they consented, and track them. If you call this method, you do not need to call setConsentGiven.

If I start our application with e.g. Tracking enabled and turn it off with forgetConsentGiven() and re-enable it with rememberConsentGiven(24 * 90) (24h * 90d) the return value of hasConsent() is false. So Matomo does not track new events etc.

If I re-enable it with:

this.$matomo && this.$matomo.setConsentGiven();
this.$matomo && this.$matomo.rememberConsentGiven(24 * 90);

the return value of hasConsent() is true and Matomo does track new events etc.

Is this an issue in my application or the behavior that vue-matomo does not re-enable the tracking with "just" rememberConsentGiven(value);?

AmazingDreams commented 4 years ago

Hello, vue-matomo basically just simplifies the loading, initial configuration and tracking page views of Matomo itself. Any methods you call on this.$matomo is called directly on the matomo object. It sounds like you discovered a bug in Matomo itself so you'll probably want to open this issue there