jordanbeattie/craftcms-cookie-consent
最新稳定版本:1.0.1
Composer 安装命令:
composer require jordanbeattie/craftcms-cookie-consent
包简介
Consent manager for Google Tag Manager
README 文档
README
This plugin will add a popup to the bottom-right of the page informing users that the website uses cookies and allows them to enable/disable advertisement and analytics cookies.
Requirements
The project must be using AlpineJS, TailwindCSS and CraftCMS.
Installation
Add the below hook to your <head> element.
{% hook 'cookie-consent' %}
Add the following to your tailwind.config.js
content: [
...
'./vendor/jordanbeattie/craftcms-cookie-consent/**/*.twig'
],
Customisation
Style
You can use the following IDs to target individual elements in the popup
CookieConsentCookieConsent__WrapperCookieConsent__DefaultContentCookieConsent__HeadlineCookieConsent__CopyCookieConsent__ButtonsCookieConsent__AcceptButtonsCookieConsent__AcceptButtonCookieConsent__NecessaryOnlyButtonCookieConsent__MoreuttonCookieConsent__DetailContentCookieConsent__OptionsCookieConsent__NecessaryCookieConsent__AnalyticsCookieConsent__AdvertisementCookieConsent__PolicyLinkCookieConsent__DetailButtonsCookieConsent__SubmitButtonCookieConsent__LessButton
Content
The majority of the content within the popup can be customised via a config file. Running the below command will create a coookie-consent.php file in your config directory which you can customise.
php craft cookie-consent/config
Usage
In your Twig templates, you can use the following function to check whether a user has accepted analytics or advertisement cookies.
craft.cookieConsent.getConsent()
统计信息
- 总下载量: 29
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-01-17