EU laws require sites to let the user know if cookies are stored on their devices. Depending on EU country there are different types of compliance implementation. Usually scripts like this one only offer notifications and they dont implement real opt-in or opt-out compliance.
This script offers OctoberCMS implementation of Cookie Consent JS, additional Twig template function for easier checks whether or not to serve cookies and additional JS that cleans all cookies if user declines to accept cookies.
This plugin integrates the popular Cookie Consent tool in your theme. It requires
the theme to have the scripts
and styles
placeholder.
Simply configure the settings from the backend interface and then it automatically runs on the frontend. Please see how to prevent cookies section as well. Remember that you are soly responsible for any law and regulation compliance.
- info (allways serve cookies)
- opt-in (dont serve cookies unless explicit permission)
- opt-out (serve cookies unless visitor declines serving)
This is only Javascript frontend (as all other plugins)! It sets cookies based on user decision whether to allow or reject cookies. You will need to code your PHP to check upon users decision before setting any cookies.
There is a view helper allow_cookies
that you can call from twig template.
Example:
{% if allow_cookies() %}
// javascript for serving cookies like Google Analytics etc
{% endif %}
If you need to access user decision, cookie is named cookieconsent_status
unless you renamed it in configuration.
Cookie can have values:
- dismiss
- allow
- deny
The Cookie Consent JS we link to is developed by Insites and released under MIT.
Icon made by Freepik from www.flaticon.com and released under CC 3.0.