alt-design/alt-cookies
Composer 安装命令:
composer require alt-design/alt-cookies
包简介
Helps handle scripts and cookies on your Statamic site
README 文档
README
Easily manage consent for Google consent mode v2 and other optional tracking
Features
This addon features:
- Ez Google Analytics controls
- Custom Cookie Lifetime
- Necessary, Analytics and Advertising Cookies fields
- Replaceable default consent popup
How to Install
You can search for this addon in the Tools > Addons section of the Statamic control panel and click install, or run the following command from your project root:
composer require alt-design/alt-cookies
Basic Use
To enable the default consent popup:
- Open up your main
Template.antlers.htmlor equivalent - Add our
{{ AltCookies:Toast }}tag before the closing</body>tag - Add a way to change the preferences, up to you here, but for example,
<button onclick="{{ AltCookies:reset }}">Cookie Preferences</button> - You're away!!
To configure Google Analytics :
- Navigate to your
Control Panel > Alt Cookies - Head to the
Googletab - Simply enter your Google Tag ID
- Add our consent popup or make sure the Alt Cookies scripts are loaded if you're doing a custom popup
To configure other tracking :
- Navigate to your
Control Panel > Alt Cookies - Head to the
Generaltab - Add your
<script>tags for other tracking here in the appropriate boxes. - Note that
AnalyticsandAdvertisingcan be toggled. - These will then get put on page according to the consent level the user agreed to.
Necessarycookies always appear on page- WARNING : These fields place what you put in them onto the page. Please check for errors and make sure that the code you put in here is safe.
Advanced Use
To build a custom cookie popup:
- Open up your master
Template.antlers.htmlor equivalent - Add our
{{ AltCookies:Scripts }}tag to your popup view. - You'll need an "Accept" and "Accept Necessary" button.
- The "Accept" button needs to have
{{ AltCookies:accept }}in it's onclick - The "Accept Necessary" button needs to have
{{ AltCookies:decline }}in it's onclick - You will then need at least 2 checkboxes to configure analytics and advertising cookies.
- The Analytics checkbox requires an id of
alt-cookies-analyticsfor the Javascript to hook into - The Analytics checkbox requires an id of
alt-cookies-advertisingfor the Javascript to hook into - If you just want to allow
NecessaryandAllcookies as your options, then you could hide these checkboxes and give them thecheckedproperty. They just need to exist.
Questions etc
Drop us a big shout-out if you have any questions, comments, or concerns. We're always looking to improve our addons, so if you have any feature requests, we'd love to hear them.
Starter Kits
Addons
- Alt Redirect Addon
- Alt Sitemap Addon
- Alt Akismet Addon
- Alt Password Protect Addon
- Alt Cookies Addon
- Alt Inbound Addon
- Alt Google 2FA Addon
Postcardware
Send us a postcard from your hometown if you like this addon. We love getting mail from other cool peeps!
Alt Design
St Helens House
Derby
DE1 3EE
UK
alt-design/alt-cookies 适用场景与选型建议
alt-design/alt-cookies 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.7k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2024 年 04 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 alt-design/alt-cookies 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alt-design/alt-cookies 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.7k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-04-09