Documentation

Table of Contents

  1. Introduction
  2. Requirements
  3. Installation
  4. Usage
  5. Whats new in 1.3.6?
  6. Change Log
  7. Sources and Credits

Introduction

Slavlee Cookie Control is a extension that shows an alert to ask the user to accept or decline your cookie policy.

This extension helps your TYPO3 website to comply the General Data Protection Regulation (GDPR or DSGVO). You can access the decision of the user via TypoScript or PHP - wise in your own extension. 
So, you can react on it like loading tracking tools, only when the user accepted your cookie policy.

Requirements

Installation

You can install this extension with the Typo3 own extension manager. Simply go to

  1. "Admin Tools"
  2. Select "Extensions"
  3. Click on the upload button
  4. Select cookie_control.zip

After you have installed it, you need to include the Static TS into your main typoscript template. To do so, go to the page that holds your root template. In most cases this is the root page, which has the globe icon.

You access the template with the Template module.

  1. Web
  2. Template
  3. Click on the page that holds the root template
  4. Select "Info/Modify" on the selectbox at the top
  5. Click on the "Edit the whole template record"
  6. Go to the "Includes" tab
  7. Select "Slavlee Cookie Control" in the list of available items

If you already using jQuery or Bootsrap 3/4, then you have to exclude those files. You can do that with the Constant Editor:

Slavlee Cookie Control expects to set the page id of the privacy page. See D) Usage for more information.

That's it!

Usage

The Slavlee Cookie Control has a few settings.

Enable

This enables the whole extension.

Privacy Page

The GDPR force you to inform your users about all features and tools that are handling personal data. That's why Slavlee Cookie Control expects a page id of your privacy page. You can and must set the id in this option.

Tracking Tool

If you are using any kind of tracking tool, then enable this option. This will include one more paragraph in the Cookie alert box for the advanced mode.

Mode

There are currently two different modes:

The simple mode shows a alert box at the top of the page with a generic paragraph to inform your users, that your site is using cookies. This paragraph also include a hyperlink to your privacy page.

The advanced mode shows a form, where the user must decide if they want to enable or disable cookies. If he chooses to disable cookies, then all cookies set for this page will be deleted. To avoid embedding any kind of features that are setting cookies, like tracking tools. You can get the decision of the user, when he enabled cookies in TypoScript.

 

You can do this like so:

# If Cookie accepted, then include Google Services
[Slavlee\CookieControl\TypoScript\CookiesAcceptCondition]
page.includeCSSLibs.googlewebfont = fonts.googleapis.com/css Sans Pro:300,400,700
page.jsFooterInline.10.10.value = (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');    ga('create', '', 'auto');
popup.includeCSSLibs.googlewebfont = fonts.googleapis.com/css Sans Pro:300,400,700
popup.jsFooterInline.10.10.value = (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');    ga('create', '', 'auto');
[global]
    

In this example the Google Analytics and the Google Font embeddings will be added, when the user accepted the cookies.

To use this extension properly, I recommend to exclude all scripts and fonts and anything that is from Google, Facebook and any other provider for scripts that setting cookies on your page (you can do this mostly with TypoScript). Then use the CookieAcceptCondition to include all these scripts and services like in the example above.

Changing Text

If you want to change the text in the alert box, then you can do this with TypoScript with the known: _LOCAL_LANG feature. Here is an example:

page.5._LOCAL_LANG {
	default {
		cookie_control.alert.title = Alert title
		cookie_control.alert.text.I.0 = This is a alternative text for the Cookie Control extensions. <a href="%s" target="_blank" class="alert-link">Cookie Policy</a>.
		cookie_control.alert.text.I.1 = Second paragraph
		cookie_control.form.agree = Agree Button Label
		cookie_control.form.deny = Deny Button Label
		cookie_control.alert.settings = Toggle Cookie Control
		cookie_control.alert.gotit = OK!
	}

	de {
		cookie_control.alert.title = German alert title
		cookie_control.alert.text.I.0 = This is a alternative text for the Cookie Control extensions. <a href="%s" target="_blank" class="alert-link">Cookie Policy</a>.
		cookie_control.alert.text.I.1 = Second paragraph
		cookie_control.form.agree = Agree Button Label
		cookie_control.form.deny = Deny Button Label
		cookie_control.alert.settings = Toggle Cookie Control
		cookie_control.alert.gotit = OK!
 	}
}    
    

The extension will be set with TypoScript at the position page.5 by default. If this position is already occupied in your TYPO3 page, then you have to set the extension on your own. You can do this like so:

page.5 = USER
page.5 {
	userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
	extensionName = CookieControl
	pluginName = CookieControl
	vendorName = Slavlee
	controller = CookieControl
	action = show
	view < plugin.tx_cookie_control.view
	persistence < plugin.tx_cookie_control.persistence
	settings < plugin.tx_cookie_control.settings
}    
    

Simply choose a different number than 5 that don't disturb your TYPO3 page.

Whats new in 1.3.6?

General

The decision the use made will be saved in the TYPO3 session and also in a custom cookie. This cookie does not contain any personal data and only for the use of this extension.

If the user decided to deny cookies, then those denied cookies will be deleted on each request.

Simple mode

The simple mode has been changed to be a form that will be submitted. These needs to be done to enable the cookies. Without that decision all cookies will be deleted on each request.

Advanced mode

The advanced mode works like the simple mode in terms of cookie deletion in the first place. In addition the advanced mode has been extended with the option to set a list of categories with TypoScript.

These categories will be shown inside the form and the user can decide which cookie categories he wants to accept or not. 
On this way the user has more options to customize his experience. It's your job to give these categories meaningful names and describe them further more on your privacy page.

The categories can look like this:

In TypoScript you can add as much categories as you want. Each category expects the following parameters:

Here is an example:

# Cookie Control categories
page.5.settings {
categories {
  10 {
    label = LLL:EXT:cookie_control/Resources/Private/Language/locallang.xlf:category.necessary.label
    cookies =
    urls =  
  }
  20 {
    label = LLL:EXT:cookie_control/Resources/Private/Language/locallang.xlf:category.functional.label
    cookies = be_lastLoginProvider,be_typo_user,be_typo_user,fe_typo_user
    urls =  
  }
  30 {
    label = LLL:EXT:cookie_control/Resources/Private/Language/locallang.xlf:category.tracking.label
    cookies = _ga,_gid,_gat,__utma,__utmt,__utmb,__utmc,__utmc,__utmv,__utmx,__utmxx,_gaexp
    urls =  admob.com,adsensecustomsearchads.com,adwords.com,doubleclick.net,google.com,googleadservices.com,googleapis.com,googlesyndication.com,googletagmanager.com,googletagservices.com,googletraveladservices.com,googleusercontent.com,google-analytics.com,gstatic.com,urchin.com,youtube.com,ytimg.com
   }
}
}
	

The label can be a static text or handled via language file. 
The cookies and urls is a comma separated list, ideally without space inbetween.

The cookie names are these cookies that will be deleted, if the user choose not to accept the category. So every cookie that is not mentioned will not be touched. 
The list of URLs works the same way. What it does, it parse the HTML content for those URLs and replace it with service.disabled. On this way each service won't establish a connetion to the actual service and it is disabled and not working anymore.

Change Log

Version 1.3.6:

Version 1.2.4:

Version 1.2.3:

Version 1.1.2:

Version 1.1.1:

Version 1.0:

Sources and Credits

I've used the following scripts and codes as listed.