Documentation

Using this add-on is really simple, so you don't need to read any long guides for that. Just install the add-on and it's there.

If you want to manage the add-on settings, go to:
Dashboard => System & Settings => Basics => Cookies Disclosure Settings

Prevent Tracking Scripts From Running

The cookie law states that before users have allowed the cookies to be added, e.g. the tracking scripts should not run (because they set cookies that are not essential for the site). Before user has allowed cookies for the site, this add-on tries automatically to find the tracking codes inserted from c5 interface.

However, no guarantee is given that the automatic removal of tracking codes will work because e.g. if you minify your HTML source code, the string match search will not find your tracking codes automatically. In most situations this should work ok but to guarantee that it works, it is really suggested to check your source code and see for yourself that the tracking codes disappear before cookies have been enabled.

If the automatic removal does not work, you can try either option presented below to disable the tracking scripts instead.

Alternative option 1. Prevent tracking codes from displaying on your site's source

You can easily prevent tracking codes to be added to your site's source before users have allowed cookies. In order to do this, you'll need to change one line from your theme's code. With this add-on installed, you have a PHP constant named 'COOKIES_ALLOWED' that can be used to detect whether user has allowed cookies.

Tracking code in footer

If you display the tracking codes in your footer, please open your theme's footer.php and find this line:

<?php Loader::element('footer_required'); ?>

Change that line to:

<?php Loader::element('footer_required', array('disableTrackingCode' => !COOKIES_ALLOWED)); ?>

Tracking code in header

If you display the tracking codes in your header, please open your theme's header.php and find this line:

<?php Loader::element('header_required'); ?>

Change that line to:

<?php Loader::element('header_required', array('disableTrackingCode' => !COOKIES_ALLOWED)); ?>

Alternative option 2. Prevent tracking codes from running in JavaScript

With this add-on installed you also have a global JavaScript variable named 'COOKIES_ALLOWED' in your use throughout the site. This means that you can also modify your tracking code script in Dashboard => System & Settings => SEO & Statistics => Tracking Codes. Just wrap your tracking code into this if-clause:

<script type="text/javascript">if (COOKIES_ALLOWED) {
	// Add here your normal tracking script WITHOUT the script-tag
}</script>

Change Notification Content

You can change the cookie notification content with the Stacks functionality in concrete5. If you don't have  Internationalization installed, it's enough to create a stack called "Cookies Disclosure" and add the content you want to appear on the notification box to that stack.

Please note the stack name must appear in the same format as specified above.

For showing the cookies acceptance form in the notification box, please use block named "Cookies Disclosure Form" that comes with this add-on.

Customize Notification with Internationalization

If you've installed Internationalization, you probably need to show the notification in different languages. This can be easily done through the stacks as well. You just need to create own stack for each language.

For example, if you're running your site in English and Finnish, create the following stacks to manage the notification content:

  • Cookies Disclosure - EN
  • Cookies Disclosure - FI

Please note that the language code must be in uppercase and there must be a space before and after the dash.