@gluedigital/cookie-consent
v1.1.3
Published
cookie-consent React component
Downloads
18
Keywords
Readme
Cookie-Consent
Cookie-Consent provides a way to manage user consent under the GDPR for React sites.
Introduction
Starting the 25th of May of 2018, all sites in the EU or available to EU visitors must comply with the GDPR regulation. Among other things, this means that users must be informed of what kind of personal information will be collected, and for what purposes, and consent must be obtained for all uses that don't fall under one of the exemptions (such as legitimate interest, or legal requisite).
This component provides an easy way of complying with the regulation, by adding a notification to the page, from which the full info can be accessed, and holding off any data collection until consent is obtained. For this to work, all data collection scripts must be added through this component.
This component is compatible with server-side rendering, and works great with React Helmet.
Usage
To use Cookie-Consent, start by installing it:
npm install @gluedigital/cookie-consent
And add it to your page component like this:
import CookieConsent, { Category, Partner } from '@gluedigital/cookie-consent'
/* on your render jsx: */
<CookieConsent banner="We use cookies to provide you a better experience.">
<Category id="mandatory" description="Cookies required for the delivery of the service" required>
<Partner id="cfduid" company="Cloudflare Inc." />
</Category>
<Category id="tracking" description="Cookies that allow us to monitor site usage">
<Partner id="ga" name="Google Analytics" html="..." />
</Category>
</CookieConsent>