381

Product support

Get help in the plugin support forum.

  • Added on Jan 14, 2022
  • Current version: 1.1.1
  • Compatibility
    October CMS v3.x use latest
    October CMS v2.x use latest
    October CMS v1.x use latest
  • Created by

Categories

This plugin offer cookie consent for your visitors. Web admin can define multiple kinds of cookies (technical, analytical, etc.). User can accept all or just some subset of defined cookies. There is a comfortable API to check if user accepted cookie by its key.

Cookie consent banner

Set up

  1. Install plugin from marketplace.
  2. Define kinds of cookies you want to manage on your site in administration.
  3. Check if you have {% styles %}, {% script %} and Framework extras added in your layout.
  4. Include cookieConsent component to your layout.
<!-- /layouts/default.htm -->
[cookieConsent]
==
<!doctype html>
<html lang="en">
<head>
    ...
</head>
<body>
    ...
    {% component 'cookieConsent' %}
    ...
</body>
</html>
  1. In your theme create files partials/cookieConsent/_scripts.htm and partials/cookieConsent/styles.htm. For example, their content should be as follows:
<!-- partials/cookieConsent/_scripts.htm -->
{% if cookieConsent.isCookiesAllowed("analytical_cookies") %}
    <script>
        // Some Google Analytics init script here
    </script>
{% endif %}

Here you can check if user accepted specific cookie by its key attribute.

The example above shows a case where there is a Analytical cookie define with key analytical_cookies. If user allows this kind of cookie, let's add some Google Analytics scripts.

Managing already accepted cookies

To manage already accepted cookies you can define link with data-request attribute that opens up the manage cookies dialog.

<a data-request="cookieConsent::onManageCookies">
    Manage cookies
</a>
  • Found the plugin useful on 2 Feb, 2022

    First of all: great and easy-to-use plugin. But I have one problem: cookieConsent.isCookieAllowed is only available after refreshing the page. So I have no cookies allowed on the first page hit after the user accepted already all cookies. Any solutions for that?

  • author

    Replied on 7 Feb, 2022

    Hello, thanx for your positive feedback. You are right, allowed scripts have not been refreshed immediately after user's consent. I released version v1.1.0 that fixes this issue. It is necessary to define allowed scripts in standalone partial partials/cookieConsent/_scripts.htm. Read DOCUMENTATION section for complete setup example.

1.1.1

Cookie consent stylesheet customization improved

Feb 17, 2022

1.1.0

Redraw allowed scripts immediately after the user's consent

Feb 07, 2022

1.0.1

Initial version

Jan 14, 2022

1.0.1 → 1.1.0

It's necessary to create partial partials/cookieConsent/_scripts.html with allowed scripts. See README for examples.