whitecube / laravel-cookie-consent

Register, configure and ask for cookies consent in a EU-compliant way
MIT License
312 stars 37 forks source link

Consent reset does not automatically remove Google Analytics cookies #5

Open eldIsher opened 1 year ago

eldIsher commented 1 year ago

@cookieconsentbutton('reset') opens modal, but clicking 'Only essentials' does not clear Google Analytics cookies. It only (re)sets the consent settings

README.md says this one

generate a button that will reset the user's cookies and show the consent modal again.

it is not now resetting cookies. Google Analytics cookies still in browser

toonvandenbos commented 1 year ago

Hi @eldIsher,

Thanks for reporting this.

Removing the Google Analytics cookies will mess with the analytics data if the user decides to accept them again after the reset. However, I guess we should indeed remove the cookies set by Google Analytics in this scenario.

There doesn't seem to be a straightforward official way to do so. Google Analytics has a tendency to change their cookie names every now and then (sometimes during a major version's lifetime if I recall correctly), I'd rather have an official JS method to remove all used cookies at once rather than having to make wild guesses in the package's backend...

What's your take on this?

eldIsher commented 1 year ago

hi @toonvandenbos

thanks for your response. I do not know it will mess with googleAnalytics when is removed. Is there official statement from google?

Remember to update App/Http/Middleware/EncryptCookies.php if you change cookie from JS because cookie is encrypted. It is empty if changed from browser, backend cannot read it. Make it unencrypted to make it work.

If cookie name changes this package needs update anyhow, right?