Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add the ability to use cookies for consent #466

Closed
wants to merge 2 commits into from

Conversation

RonkZeDonk
Copy link

@RonkZeDonk RonkZeDonk commented May 14, 2023

Hey there,

I added a feature that allows us to remember consent between pages and sessions. If a prop the GoogleAnalytics component has the consentCookie prop, it'll grab the JSON data from that cookie and apply it. I also added a couple utility functions to get and set those cookies from the browser. Additionally this PR adds a hook that simplifies the process of creating consent prompts. I've left an example usages in the README.

Currently, I only allow the developer to use either consentCookie or defaultConsent but not both. Another way we could handle this is to use the value of defaultConsent to dictate the default when the cookie isn't present. The current method is more GDPR friendly, however it might be nice to offer more options. Making consent granted by default right now would involve waiting for a component to mount and running either the consent function or the updateConsent function from the useConsent hook. I was wondering if I could get some opinions on this?

Resolves #447

TODO

  • Related tests

@RonkZeDonk RonkZeDonk closed this Nov 16, 2023
@RonkZeDonk RonkZeDonk deleted the consent-cookies branch March 1, 2024 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How do you use the Consent API?
1 participant