datareporter/module-webcare
Composer 安装命令:
composer require datareporter/module-webcare
包简介
Magento2 module to embed DataReporter WebCare elements (imprint, privacy notice, cookie banner)
README 文档
README
Magento2 module to embed DataReporter WebCare elements (imprint, privacy notice, cookie banner)
Installation
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
Features
Imprint
Use class \DataReporter\WebCare\Block\ImprintBlock or embedd into CMS-Page/Block as Widget named 'WebCare - Imprint'
Privacy Notice
Use class \DataReporter\WebCare\Block\PrivacyNoticeBlock or embedd into CMS-Page/Block as Widget named 'WebCare - Privacy Notice'
Cookie Banner
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
Configuration
- URL for the Webcache-Server, normally this is https://webcache-eu.datareporter.eu/c/ if the DataReporter-Suite is not self hosted
- Add Store configured language to the resource calls to override any other default language settings in DataReporter
- En-/Disabling of the Imprint-, Privacy Notice- and Cookie-Banner-Block to seperatelly controll if they are used
- En-/Disabling of Cookie Banner Custom Options, the default is no, as the standard method delivered by DataReporter are handling the denying of cookies quite well.
Loader Mode (CSP/SRI compliant)
The Loader Mode enables full compliance with strict Content Security Policy (CSP) and Subresource Integrity (SRI) requirements. Instead of loading the cookie banner script directly from the WebCache server, the Loader Mode uses a dedicated Loader script that handles all resource loading in a CSP-compatible way.
When Loader Mode is active:
- The cookie banner is loaded via the Loader script instead of direct banner files
- The separate CSS head block and custom options block are automatically suppressed
- Imprint and Privacy Notice render only the target
<div>container (the Loader injects content) - An optional SRI hash can be configured to enforce script integrity verification
Configuration options under Stores -> Configuration -> DataReporter -> Settings -> WebCare:
| Option | Description | Default |
|---|---|---|
| Loader Mode (CSP/SRI compliant) | Enable/disable Loader Mode | Disabled |
| Loader URL | Base URL for the Loader script | https://webcachex-eu.datareporter.eu/loader/v5/cmp-load.js |
| Loader Integration Key (optional) | WebCare Integration Key for the Loader. If empty, auto-generated from Client ID, Organisation ID and Website ID | — |
| SRI Hash | Subresource Integrity hash for the Loader script. Leave empty to disable SRI | Pre-configured default hash |
The Integration Key is automatically derived from your existing DataReporter configuration ({client_id}.{organisation_id}.{website_id}) if not explicitly set.
Example of the rendered script tag with SRI enabled:
<script src="https://webcachex-eu.datareporter.eu/loader/v5/cmp-load.js?url=<integration-key>" defer integrity="sha384-..." crossorigin="anonymous"></script>
Example
- Widget selection within a CMS-Page/Block:
- Enhancing cookiebanner functions:
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"/>
Demo
Use following Demo-Credentials if you wanna try out the module, see Privacy -> Configuration
- Client-Id: 33f002cc-2586-42b6-987d-548b2953c7b8
- Organisation-Id: R5spy6ZYDqA
datareporter/module-webcare 适用场景与选型建议
datareporter/module-webcare 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 25.03k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 02 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「composer-installer」 「magento2」 「data privacy」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 datareporter/module-webcare 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 datareporter/module-webcare 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 datareporter/module-webcare 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Shoot aims to make providing data to your templates more manageable
Russian Language Pack for Magento 2
DPD Magento2 Shipping extension
Entity services for magento2
Adds the EDTF data type to Wikibase
Module to add React to Magento 2 KO frontend
统计信息
- 总下载量: 25.03k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 35
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-21

