2017 © Pedro Peláez
 

silverstripe-vendormodule cookieconsent

GDPR compliant cookie bar and consent checker

image

bramdeleeuw/cookieconsent

GDPR compliant cookie bar and consent checker

  • Friday, July 27, 2018
  • by TheBnl
  • Repository
  • 3 Watchers
  • 2 Stars
  • 143 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 40 Versions
  • 1489 % Grown

The README.md

Silverstripe Cookie Consent

GDPR compliant cookie bar and consent checker, (*1)

Installation

Install the module trough composer:, (*2)

composer require bramdeleeuw/cookieconsent

Include the popup template in your base Page.ss, (*3)

<% include CookieConsent %>

Configuration

You can configure the cookies and cookie groups trough the yml config. You need to configure by provider, for providers the dots are converted to underscores e.g. ads.marketingcompany.com becomes ads_marketingcompany_com., (*4)

By configuring cookies trough yml you can check for consent in your code and make the necessary changes e.g. require the analytics or other cookies or skip placing them., (*5)

The texts for the configured cookies are editable trough the Site Config, here other cookies can also be added by CMS users. For example if a site user decides to embed a Youtube video he or she can specify the cookies that are placed by Youtube. I reccomend the following three groups to be created, these have default content, of course you are free to configure groups as you see fit., (*6)

Broarm\CookieConsent\CookieConsent:
  cookies:
    Necessary:
      local:
        - CookieConsent
        - ShowPopUp
    Marketing:
      ads_marketingcompany_com:
        - _track
    Analytics:
      local:
        - _ga
        - _gid

This module comes with some default content for cookies we've encountered before. If you want to set default content for these cookies yourself that is possible trough the lang files. If you have cookie descriptions that are not in this module, contributions to the lang files are much appreciated! Translations are managed trough Transifex., (*7)

The files are structured as such:, (*8)

en:
  CookieConsent_{provider}:
    {cookie}_Purpose: 'Cookie description'
    {cookie}_Expiry: 'Cookie expire time'
  # for cookies from your own domain:
  CookieConsent_local:
    PHPSESSID_Purpose: 'Session'
    PHPSESSID_Expiry: 'Session'
  # for cookies from an external domain:
  CookieConsent_ads_marketingcompany_com:
    _track_Purpose: 'Cookie description'
    _track_Expiry: 'Cookie expire time'

Then you can check for consent in your code by calling, (*9)

if (CookieConsent::check('Analytics')) {
    // include google analytics
}

You can also configure the requirement of the default js and css. Make sure you combine at least the javascript in you bundle if you chose not to require by default!, (*10)

Broarm\CookieConsent\CookieConsent:
  include_javascript: true
  include_css: true
  create_default_pages: true

Enable XHR mode

When you use static publishing, you'll want to enable XHR mode. XHR mode accepts the cookies trough an xhr request and shows/hides the consent popup with the help of some javascript., (*11)

In your yml config set xhr_mode to true, (*12)

Broarm\CookieConsent\CookieConsent:
  xhr_mode: true

In your javascript, you can make use of the utility class. This handles the xhr request and visibility of the popup:, (*13)

import CookieConsent from '../vendor/bramdeleeuw/cookieconsent/javascript/src/cookieconsent';
const consent = new CookieConsent();
consent.enableXHRMode();

Include assets in your bundle

If you want to include the scss or js in your own bundle you can do that by:, (*14)

// Import the CookieConsent utility 
import CookieConsent from '../vendor/bramdeleeuw/cookieconsent/javascript/src/cookieconsent';

const consent = new CookieConsent();

// This tool let's you check for cookie consent in your js files before you apply any cookies
if (consent.check('Marketing')) {
  // add marketing cookie
}

// If you use Google Tag Manager this tool can also push the consent into the dataLayer object
consent.pushToDataLayer();

For the scss you can just import the scss file, (*15)

@import "cookieconsent/scss/cookieconsent";

Make sure the relative paths to the files match your use case., (*16)

Default Pages

This module also sets up 3 default pages on running dev/build. If you want to prevent that behaviour you should disable the create_default_pages config setting. The pages created are a CookiePolicyPage, PrivacyPolicyPage and TermsAndConditionsPage and are filled with bare bones content for each of the page types. Of course it is your or your CMS users responsibility to alter these texts to make them fitting to your use case!, (*17)

Maintainers

Bram de Leeuw, (*18)

The Versions

27/07 2018

dev-master

9999999-dev

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

27/07 2018

2.0.6

2.0.6.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

13/07 2018

1.x-dev

1.9999999.9999999.9999999-dev

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

13/07 2018

1.2.12

1.2.12.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

13/07 2018

2.0.5

2.0.5.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

10/07 2018

1.2.11

1.2.11.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

10/07 2018

2.0.4

2.0.4.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

10/07 2018

2.0.3

2.0.3.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

10/07 2018

1.2.10

1.2.10.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

09/07 2018

1.2.9

1.2.9.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

09/07 2018

2.0.2

2.0.2.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

09/07 2018

2.0.1

2.0.1.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

09/07 2018

2.0.0

2.0.0.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

29/06 2018

1.2.8

1.2.8.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

29/06 2018

1.2.7

1.2.7.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

27/06 2018

1.2.6

1.2.6.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

26/06 2018

1.2.5

1.2.5.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

26/06 2018

1.2.4

1.2.4.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

26/06 2018

1.2.3

1.2.3.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

26/06 2018

1.2.2

1.2.2.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

26/06 2018

1.2.1

1.2.1.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

22/06 2018

1.2.0

1.2.0.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

22/06 2018

1.1.3

1.1.3.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

22/06 2018

1.1.2

1.1.2.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

22/06 2018

1.1.1

1.1.1.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

22/06 2018

1.1.0

1.1.0.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

05/06 2018

1.0.13

1.0.13.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

05/06 2018

1.0.12

1.0.12.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

04/06 2018

1.0.11

1.0.11.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

04/06 2018

1.0.10

1.0.10.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

04/06 2018

1.0.9

1.0.9.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

04/06 2018

1.0.8

1.0.8.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

04/06 2018

1.0.7

1.0.7.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

29/05 2018

1.0.6

1.0.6.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

29/05 2018

1.0.5

1.0.5.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

29/05 2018

1.0.4

1.0.4.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

29/05 2018

1.0.3

1.0.3.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

29/05 2018

1.0.2

1.0.2.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

29/05 2018

1.0.1

1.0.1.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr

29/05 2018

1.0.0

1.0.0.0

GDPR compliant cookie bar and consent checker

  Sources   Download

BSD-3-Clause

The Requires

 

cookie silverstripe bar consent gdpr