Giter Site home page Giter Site logo

cookiebotaddons's Introduction

Cookiebot Wordpress Addons

Cookiebot Addons are plugins for Wordpress that make other plugins compatible with Cookiebot. The addons hook into the original plugin and render the cookie setting tags as advised by the Cookiebot guidelines at https://www.cookiebot.com/goto/help/.

News on GADWP

GADWP is about to release a GDPR compliance addon, which supports Cookiebot. We'll provide a link here once the addon is released.

Installation

  1. Copy the framework plugin to your WP plugins folder
  2. Go to the admin page of your WP installation and activate the plugin
  3. You are done, verify that it works

Roadmap

Following plugins are in pipeline:

If you have a plugin that you would like integration for, please submit a request in the Issues section.

How do I make my plugin support Cookiebot?

If you favourite plugins doesn’t support Cookiebot you are always welcome to ask the author to add support for Cookiebot. Cookiebot provides a helper function to check if there is an active, working version of Cookiebot on the website. The easiest way for at developer to implement Cookiebot support is to add a check for Cookiebot where tags are outputted to the visitor.

This can be done following way:

$scriptTag = ";
if(function_exists('cookiebot_active') && cookiebot_active()) {
$scriptTag = '<script'.cookiebot_assist('statistics').'>';
}

A users consent state can be be aquired through Cookiebots JS API.

The following properties are available on the CookieConsent object:

Name Type Default Description
consent.necessary bool true True if current user has accepted necessary cookies.
The property is read only.
consent.preferences bool false True if current user has accepted preference cookies.
The property is read only.
consent.statistics bool false True if current user has accepted statistics cookies.
The property is read only.
consent.marketing bool false True if current user has accepted marketing cookies.
The property is read only.
consented bool false True if the user has accepted cookies.
The property is read only.
declined bool false True if the user has declined the use of cookies.
The property is read only.
hasResponse bool false True if the user has responded to the dialog with either 'accept' or 'decline'.
doNotTrack bool false True if the user has enabled the web browser's 'Do not track' (DNT) setting.
If DNT is enabled Cookiebot will not set the third party cookie CookieConsentBulkTicket used for bulk consent.
The property is read only.

And through PHP:

if (isset($_COOKIE["CookieConsent"]))
{
    switch ($_COOKIE["CookieConsent"])
    {
        case "0":
            //The user has not accepted cookies - set strictly necessary cookies only
            break;

        case "-1":
            //The user is not within a region that requires consent - all cookies are accepted
            break;

        default: //The user has accepted one or more type of cookies
            
            //Read current user consent in encoded JavaScript format
            $valid_php_json = preg_replace('/\s*:\s*([a-zA-Z0-9_]+?)([}\[,])/', ':"$1"$2', preg_replace('/([{\[,])\s*([a-zA-Z0-9_]+?):/', '$1"$2":', str_replace("'", '"',stripslashes($_COOKIE["CookieConsent"]))));
            $CookieConsent = json_decode($valid_php_json);

            if (filter_var($CookieConsent->preferences, FILTER_VALIDATE_BOOLEAN))
            {
                //Current user accepts preference cookies
            }
            else
            {
                //Current user does NOT accept preference cookies
            }

            if (filter_var($CookieConsent->statistics, FILTER_VALIDATE_BOOLEAN))
            {
                //Current user accepts statistics cookies
            }
            else
            {
                //Current user does NOT accept statistics cookies
            }

            if (filter_var($CookieConsent->marketing, FILTER_VALIDATE_BOOLEAN))
            {
                //Current user accepts marketing cookies
            }
            else
            {
                //Current user does NOT accept marketing cookies
            }   
    }
}
else
{
    //The user has not accepted cookies - set strictly necessary cookies only
}

More details are available at https://www.cookiebot.com/goto/developer/

Need to get in touch?

There are several ways you can get in touch with us.
We are available on the Making Wordpress Slack workspace.
Username: Kenan
You can also reach us through our helpdesk at www.cookiebot.com/goto/helpdesk/

cookiebotaddons's People

Contributors

aytackokus avatar kicybot avatar phpgeek avatar xzuttz avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.