react-cookiebot
    DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/react-cookiebot package

    1.0.10 • Public • Published

    react-cookiebot

    Build Status npm Version License NPM monthly downloads NPM total downloads npm Version Module formats Coverage Quality gate status FOSSA Status

    A simple react cookie bot component that configure Cookiebot in your react or react-native-web application.

    That will definitely work. It's also a good way to dynamically add/modify attributes. It's important that the script is the first to load though, to make sure nothing else loads first and can cause issues. Richard, Cookiebot Support

    Table of Contents


    FOSSA Status

    What is cookie bot ?

    COOKIEBOT HELPS MAKE YOUR USE OF COOKIES AND ONLINE TRACKING COMPLIANT.

    The General Data Protection Regulation (GDPR) applies to all websites with users from the EU. Check if your website’s use of cookies and online tracking is compliant with GDPR and the ePrivacy Directive (ePR).

    See what data your website collects and shares with 3rd parties – also useful for CCPA compliance (California Consumer Privacy Act).

    Visit Cookiebot website

    Demo

    View the Demo

    Usage

    Just import <CookieBot domainGroupId={domainGroupId} />, this example show how to use it and how to test if it is correctly injected in the page:

     
    import React, { useState } from 'react';
    import { Button, View, Text } from 'react-native';
    const domainGroupId = 'ecff8d69-d1cb-416f-a86f-ba55b3f38707';
    
    function App() {
      const [hasCookieBot, setHasCookieBot] = useState(undefined);
      return (
        <View style={{ flex: 1, alignItems: 'center' }}>
          <CookieBot domainGroupId={domainGroupId} />
          <Text>Click to test Cookiebot</Text>
          <Button title="TEST" onPress={() => setHasCookieBot(!!document.querySelector('#CookieBot'))} />
          <Text style={{ color: 'red', marginVertical: 10 }}>
            {hasCookieBot && `Has CookieBot: ${JSON.stringify(hasCookieBot)}`}
          </Text>
        </View>
      );
    }
    
    <App />

    React CookieBot work with react-native-web, configure your resolve extensions to resolve .web.js and .js.

    Documentation

    Read react-cookiebot documentation.

    Create a cookie bot account

    You need to create an account on cookiebot and get a domainGroupId for your web site:

    image

    Create the account

    image

    Create the domain cookie bot will handle

    image

    Configure the cookie bot layout

    image

    Configure the cookie bot language

    image

    Get your domain group id

    Don't forget to save

    image

    You will have this cookie consent displayed on your website:

    image

    Configuration

    Configure webpack to load extensions ['.web.js', '.js']:

    {
      "resolve": {
        "extensions": [".web.js", ".js"]
      }
    }

    Consent banner/dialog language

    If you want to force the language of consent (for i18n):

      <CookieBot domainGroupId={domainGroupId} language="ES" />

    If consent with that language is no defined, the default language are loaded (or auto-detect).

    Use it once

    You must render this component at the root of your application, otherwise make sure your parent component does not re-rerender.

    The following will appear in your console if you break react-cookiebot: WARNING: Cookiebot script is included twice - please remove one instance to avoid unexpected results.

    Contributing

    If you want to contribute to react-cookiebot please see our contributing and community guidelines, they'll help you get set up locally and explain the whole process.

    Please also note that all repositories under the yeutech-lab organization follow our Code of Conduct, make sure to review and follow it.

    License MIT

    Copyright 2020 Yeutech Company Limited

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    Install

    npm i react-cookiebot

    DownloadsWeekly Downloads

    1,438

    Version

    1.0.10

    License

    MIT

    Unpacked Size

    308 kB

    Total Files

    13

    Last publish

    Collaborators

    • kopax