定制 jordanbeattie/craftcms-cookie-consent 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

  • CookieConsent
  • CookieConsent__Wrapper
  • CookieConsent__DefaultContent
  • CookieConsent__Headline
  • CookieConsent__Copy
  • CookieConsent__Buttons
  • CookieConsent__AcceptButtons
  • CookieConsent__AcceptButton
  • CookieConsent__NecessaryOnlyButton
  • CookieConsent__Moreutton
  • CookieConsent__DetailContent
  • CookieConsent__Options
  • CookieConsent__Necessary
  • CookieConsent__Analytics
  • CookieConsent__Advertisement
  • CookieConsent__PolicyLink
  • CookieConsent__DetailButtons
  • CookieConsent__SubmitButton
  • CookieConsent__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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: Twig

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-17