Palmabit-IT / react-cookie-law

React Cookie Law is a cookie-info banner compliance with the GDPR and the EU cookie law. It allows the user to give consent in a granular way.
115 stars 55 forks source link

Configure cookie path #16

Closed christianuhlcc closed 4 years ago

christianuhlcc commented 4 years ago

Hi, we're using react-cookie-law and see the following behaviour: the consent cookie rcl_consent_given is always set to the current path (default behaviour of the React-Cookies library you are using)

We have people landing and entering on all kinds of pages via search engine, e.g. /foo/bar/baz. Of course we have to display the cookie overlay right away. When the users consents, and then moves upwards in the directory hierarchy, they see the warning again (e,g. the cooke with the path /foo/bar/baz is not available on /foo anymore)

To solve this, one could set the path of rcl_consent_given and the others to /, so that these cookies are available for the whole domain. This could either be done via a config option or by hardcoding it in cookies.js in the options of the cookie (see https://github.com/reactivestack/cookies/tree/master/packages/react-cookie#setname-value-options)

I would be happy to provide a PR for either solution, if you can give me a hint on what you prefer :-)

b3nab commented 4 years ago

I'm doing a small update to support this as I have the same kind of problem to solve for a project I'm building.

Someone of Palmabit (the repo maintainer) are interested in a PR and release of an updated version? Because I need it as soon as possible. :+1:

However great work to all who contributed to this component! :100: