elgentos/magento2-consentmode-v2
Composer 安装命令:
composer require elgentos/magento2-consentmode-v2
包简介
Consent Mode V2 magento extension for the Hyva theme
README 文档
README
This extension is based on the Hyva default cookie bar. All features that are in that extension are in this one.
Main Functionalities
This extension:
- Overrides the default Hyva cookie bar
- Sets default consentMode
gtag('consent', 'default', { 'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'functionality_storage': 'denied', 'personalization_storage': 'denied', 'security_storage': 'denied', });
- This fires the GTM build in trigger like this:
- shows banner when consentMode is not set in localstorage or isUserAllowedSaveCookieName (default magento cookie) is null
- You can click 3 buttons
- Deny: routes you to the noCookies url you can set in the backend
- Customize: set the cookies you selected above
- Allow All: All cookies are allowed (all checkmarks are set)
Logic behind this:
{
'functionality_storage': consent.necessary ? 'granted' : 'denied',
'security_storage': consent.necessary ? 'granted' : 'denied',
'personalization_storage': consent.preferences ? 'granted' : 'denied',
'analytics_storage': consent.statistics ? 'granted' : 'denied',
'ad_storage': consent.marketing ? 'granted' : 'denied',
'ad_user_data': consent.marketing ? 'granted' : 'denied',
'ad_personalization': consent.marketing ? 'granted' : 'denied',
};
- When gtag consent default is set, an event is fired in GTM called:
defaultWhen the settings are changed, theupdateevent is fired.
As you can see in this example:
- It adds a button on the absolute bottom of the page so you can always open the cookie settings (this is intentionally not fixed on the viewport)
Would be nice to have multiple events on multiple levels of consent you can add in GTM.
Installation
- Install the package into your repository using composer.
composer require elgentos/magento2-consentmode-v2
- Enable the Magento module.
bin/magento module:enable Elgentos_ConsentModeV2
Configuration
- Enable the module in the Magento backend.
- Navigate to "Stores → Configuration → Extensions → Elgentos → Consent Mode V2".
- Set the option "Enabled" to yes.
- Turn on "Cookie Restriction Mode".
- Navigate to "Stores → Configuration → General → Web → Default Cookie Settings → Cookie Restriction Mode"
- Uncheck "Use system value" and set the option "Cookie Restriction Mode" to "Yes".
elgentos/magento2-consentmode-v2 适用场景与选型建议
elgentos/magento2-consentmode-v2 是一款 基于 HTML 开发的 Composer 扩展包,目前已累计 29.22k 次下载、GitHub Stars 达 20, 最近一次更新时间为 2024 年 05 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 elgentos/magento2-consentmode-v2 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 elgentos/magento2-consentmode-v2 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 29.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 20
- 点击次数: 29
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: OSL-3.0
- 更新时间: 2024-05-29




