AmazingDreams / vue-matomo

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

Cookie "_pk_id.14.1fff" always created #65

Closed ColinSeanKavanagh closed 4 years ago

ColinSeanKavanagh commented 4 years ago

Hello there,

I need an option, where no Cookies are created until consent is given (Opt-In). The option requireConsent is true and trackInitialView is false, however there is always a cookie created called "_pk_id.14.1fff" which contains an id that is trackable.

Another problem, which seems related: When I want to call the function disableCookies() there seems to be the problem that a "_paq.push(['trackPageView'])" was already called ( see https://matomo.org/faq/general/faq_157/).

How can I disable the function being called before consent is given?

AmazingDreams commented 4 years ago

Hello. There is another configuration option disableCookies. I think that you can use it to disable all cookies, and then enable the cookies again when the user has given consent.

AmazingDreams commented 4 years ago

It may be worthwhile to take a look at how the options are processed before the matomo script is loaded https://github.com/AmazingDreams/vue-matomo/blob/master/src/index.js#L103

adrianwix commented 4 years ago

How can you enable the cookies again? I looked in the Matomo docs and I did not found a method for that

AmazingDreams commented 4 years ago

Hmm right I see. It seems that it is not supported to manually enable cookies: https://github.com/matomo-org/matomo/issues/13056

The workaround is to reload the page and then not call disableCookies... I'm afraid I can't do much from this side

jordan-boyer commented 4 years ago

I think they a new configuration available here. We can try to implement this what do you think @AmazingDreams ?

AmazingDreams commented 4 years ago

Good find. I think it can be implemented on the application side entirely using the custom pre init actions