Type
magento2-module
Magento2 module to embed DataReporter WebCare elements (imprint, privacy notice, cookie banner)
magento2-module
MIT
None
None
None
None
None
Magento2 module to embed DataReporter WebCare elements (imprint, privacy notice, cookie banner)
The easiest way to install the extension is to use Composer.
Run the following commands:
$ composer require datareporter/module-webcare
$ bin/magento module:enable DataReporter_Core
(if not already installed and enabled)$ bin/magento module:enable DataReporter_WebCare
$ bin/magento setup:upgrade && bin/magento setup:static-content:deploy
Use class \DataReporter\WebCare\Block\ImprintBlock
or embedd into CMS-Page/Block as Widget named 'WebCare - Imprint'
Use class \DataReporter\WebCare\Block\PrivacyNoticeBlock
or embedd into CMS-Page/Block as Widget named 'WebCare - Privacy Notice'
All needed blocks are placed within the layout-xml default.xml
.
If you need to add correct cookie handling if something was denied or allowed, contribute a js content to the container
datareporter.webcare.cookiebanner.allow-handling
or datareporter.webcare.cookiebanner.deny-handling
Create your own module or adapt your themes default.xml
and add following block instruction:
<referenceContainer name="datareporter.webcare.cookiebanner.allow-handling">
<block name="test-cookiebanner-allow" class="Magento\Framework\View\Element\Template" template="cookiebanner/test.phtml"/>
</referenceContainer>
<referenceContainer name="datareporter.webcare.cookiebanner.deny-handling">
<block name="test-cookiebanner-deny" class="Magento\Framework\View\Element\Template" template="cookiebanner/test.phtml"/>
</referenceContainer>
Content of test.phtml
:
console.log('current status for cookies('+chosenBefore+'): '+status);
This will output the status of the cookie banner user interaction and all according actions and adaptions can be made to comply with the GDPR according to cookies
Adding a custom redirect handling:
In the extended cookie banner with the corresponding selection of different pages (e.g. for languages) a callback function can be registered. This is used in Magento to correctly redirect the user to the according storeview with magento internal redirects (to correctly set and transfer data from one storeview to another). This feature can be activated in the configuration: Stores -> configuration -> DataReporter -> Settings -> WebCare -> Enable Cookie Banner custom redirect after consent
Custom behavior can be added by disabling the default block and adding a custom one with another logic:
<referenceContainer name="datareporter.webcare.cookiebanner.redirect-after-consent">
<block name="test-cookiebanner-redirects" class="Magento\Framework\View\Element\Template" template="cookiebanner/test.phtml"/>
</referenceContainer>
<referenceBlock name="datareporter.webcare.cookiebanner.storeswitch-redirect" remove="true"/>
Use following Demo-Credentials if you wanna try out the module, see Privacy -> Configuration