SimpleCookie extension for Magento 2 by Team23
This module shows a modal window in which the visitor has to choose between the cookie purposes that will be set when using the shop. In order to access the website, the customer must at least accept the "essential" cookies. The visitors choice itself will be saved in a cookie, which has a default lifetime of 30 days, but can be set in the settings.
- 'Essential': all Magento 2 essential cookies
- 'Marketing': Google Analytics code (Magento_GoogleAnalytics) -> the code will be unset analogously to Magento2 CookieRestrictionMode (see Magento 2 Cookie Restriction Mode)
- Information messages: for each purpose the message can be set or removed
- Cookie Lifetime: the default lifetime the settings will be saved
There are two Magento 2 widgets:
cookie-opt-out
- allows opt-out entirely, this will remove the settings cookie and therefore the autoopening modal will shows againcookie-configuration
- allows changing the configuration options
This is a very simple implementation and is probably not enough to fulfill every GDPR/EU-ePrivacy rule entirely.
Only the default Magento 2 Google Analytics module is currently supported
It is possible to reuse the Cookie that stores the visitors settings.
Therefore one can use the simpleCookieHelper
jquery widget and its public methods defined
in Team23_SimpleCookie/js/simple-cookie
.
- Add satis.team23.de composer repository in your composer.json
composer config repositories.team23 composer https://satis.team23.de/
- Require team23/module-simplecookie
composer require team23/module-simplecookie ^dev-master
-
The analytics-js source is still not visible/visible in inspector after acceptance changes
The modal settings will be saved immediately. However, the insertion or removal of the corresponding script tag within the DOM will only take effect after one refresh or site change.
-
The analytics-js source is not visible at all, independently of the changes in the modal settings.
Make sure you have enabled Google Analytics in the Magento 2 settings: Stores -> Configuration -> Sales -> Google API -> Google Analytics
Also make sure you have cleared the caches.