kaufmanndigital/cookieconsent

一个可以直接运行的 Neos CMS 扩展包,将 Cookie Consent 添加到您的 Neos 网站

安装次数: 13,317

依赖项: 0

建议者: 0

安全性: 0

星标: 14

关注者: 3

分支: 4

开放问题: 0

语言:HTML

类型:neos-package

1.5.3 2020-05-18 09:48 UTC

This package is auto-updated.

Last update: 2024-09-18 19:14:14 UTC


README

一个可以直接运行的包,可以将 Cookie Consent 集成到您的 Neos CMS 网站。

我们创建了一个功能更多、维护更简单、配置更便捷的新包。🎉
查看 KaufmannDigital.GDPR.CookieConsent

安装

最简单的安装方式是通过 composer

composer require kaufmanndigital/cookieconsent

之后,您应该在页面上看到 Cookie 提示。

要配置策略链接,您有以下两种选择

  • 将 NodeType-Mixin KaufmannDigital.CookieConsent:PolicyPageMixin 添加到您的 Home-NodeType(如果您有特定的 NodeType 用于首页)

      'Your.Package:Document.Home':
        superTypes:
          'Neos.Neos:Document': true
          'KaufmannDigital.CookieConsent:PolicyPageMixin': true
          ...

    然后,在 Neos 后端简单选择策略页面。

  • 或者使用以下片段在您的 Settings.yaml

      KaufmannDigital:
        CookieConsent:
          #Global configuration of PolicyPage
          policyPageNode: 'c7a91aa8-fbac-4c24-8326-102eb7307180' #UUID of global page you want to link
    
          #Configuration per site for multisite installations
          #Replace site1/site2 with your sitename (/sites/sitename/node-a2ufd/.../)
          policyPageNodes:
            site1: 'c7a91aa8-fbac-4c24-8326-102eb7307180' #UUID of policy-page for /sites/site1
            site2: '454d85b6-289b-11e9-b210-d663bd873d93' #UUID of policy-page for /sites/site2

恭喜,您已将 Cookie Consent 添加到您的 Neos CMS 页面。很简单,对吧?

更改文本

Cookie Consent 中的内容通过翻译管理。如果您想更改它,将 Packages/Application/KaufmannDigital.CookieConsent/Resources/Private/Translations 文件夹复制到您的 Site-Package 中,并在 Settings.yaml 中添加此配置

KaufmannDigital:
  CookieConsent:
    translations:
      package: 'Vendor.Package'
      source: 'Main'

从现在起,将使用您的包(在本例中为 "Vendor.Package")中的翻译。

该包提供德语和英语的翻译。我们很高兴通过 Pull-Request 获得您语言的翻译。

更改布局 & 颜色

您还可以更改颜色和位置。要这样做,您必须将此片段添加到 Settings.yaml

KaufmannDigital:
  CookieConsent:
    position: 'bottom' # bottom, bottom-left, bottom-right, top, top-left or top-right
    theme: 'block' # block, classic, or edgeless
    layout: 'basic' # basic, basic-close or basic-header
    palette:
      popup:
        background: '#000' #like in css
        text: 'white' #like in css
      button:
        background: 'rgb(255, 0, 0)' #like in css
        text: '#fff' #like in css

您不需要覆盖所有值。只需选择您想要更改的值。更多配置选项可以在 cookieconsent.insites.com 找到

使用 Opt-In 或 Opt-Out

为了使用 Opt-In 或 Opt-Out 功能,您必须在设置中激活它

KaufmannDigital:
  CookieConsent:
    type: 'opt-in' #Or 'opt-out' (depending on what you want to do)

之后,您可以在 JavaScript 中监听 kd-cookieconsent 事件以启用/禁用 cookie

document.addEventListener("kd-cookieconsent", function (e) {
    if (e.detail === 'enable-cookies') {
        //Enable your cookies here
        //For Google Analytics:
        window['ga-disable-UA-<YOUR-SITE-CODE>'] = false;
    } else if (e.detail === 'disable-cookies') {
        //Disable your cookies here
        //For Google Analytics:
        window['ga-disable-UA-<YOUR-SITE-CODE>'] = true;
    }
});

将 JS & CSS 编译成自己的文件

如果您不想此包包含它自己的 JS 和 CSS,您可以在 Settings.yaml 中禁用它

KaufmannDigital:
  CookieConsent:
    includeJavaScript: false
    includeCss: false

如果您这样做,您必须包含 Cookie Consent 的 JS 和 CSS。有关说明,请参阅 此处

常见问题解答

  • Cookie Consent 在后端中没有显示。
    • 这是一个功能,而不是错误 ;-)

已知的错误

已知的错误作为问题提交。在您提供您发现的错误之前,请查看它。您修复了一个错误?太好了!请将其作为 PR 提交以与其他用户共享。

计划中的功能

计划中的功能也作为问题创建,并标记为计划中的功能。您有其他想法吗?或者您想帮助实现它?我们很高兴!只需创建新问题或 PR。

维护者

本软件包由Kaufmann Digital维护。请随时向我们发送您的疑问或请求,邮箱为support@kaufmann.digital

许可证

遵循MIT许可证,请参阅LICENSE