bootscore/bs-cookie-settings

为Bootscore添加cookie同意横幅

资助包维护!
bootscore

安装次数: 46

依赖: 0

建议者: 0

安全性: 0

星星: 8

关注者: 1

分支: 3

开放问题: 0

类型:wordpress-plugin

v5.6.2 2024-08-31 10:07 UTC

This package is auto-updated.

Last update: 2024-09-13 08:26:41 UTC


README

Packagist Prerelease Github All Releases

用以下语言阅读

WordPress插件,用于将GDPR兼容的cookie同意添加到Bootscore主题。基于Orest Bida的cookieconsent脚本。

bs Cookie Settings

安装

  1. 下载最新版本 bs-cookie-settings.zip
  2. 在您的管理面板中,转到插件 > 然后点击“添加新插件”按钮。
  3. 点击“上传插件”并选择文件,然后选择插件的.zip文件。点击“立即安装”。
  4. 点击“激活”以立即使用您的新插件。

使用方法

初始化

在“页脚信息”小部件中的“自定义HTML”小部件内使用内联脚本初始化插件,并替换您的数据。

<script>
  // Init
  window.addEventListener('load', function () {

    // obtain plugin
    var cc = initCookieConsent();

    // run plugin with your configuration
    cc.run({
      current_lang: 'en',
      autoclear_cookies: true,
      page_scripts: true,

      languages: {
        'en': {
          consent_modal: {
            title: 'We use cookies!',
            description: 'We use cookies on our website to enhance your browsing experience by remembering your preferences and analyzing site traffic. By clicking "Accept all", you consent to the use of all cookies. However, you can manage your <a data-bs-toggle="modal" href="#bs-cookie-modal">cookie preferences</a> to provide a controlled consent.',
            primary_btn: {
              text: 'Accept all',
              role: 'accept_all'
            },
            secondary_btn: {
              text: 'Reject all',
              role: 'accept_necessary'
            },
            settings_btn: {
              text: 'Manage preferences'
            },
            consent_footer: {
              description: '<a class="small link-secondary text-decoration-none" href="#">Privacy Policy</a> • <a class="small link-secondary text-decoration-none" href="#">Terms & Conditions</a> • <a class="small link-secondary text-decoration-none" href="#">Imprint</a>'
            }
          },

          settings_modal: {
            title: 'Cookie preferences',
            save_settings_btn: 'Save preferences',
            accept_all_btn: 'Accept all',
            reject_all_btn: 'Reject all',
            close_btn_label: 'Close',
            cookie_table_headers: [
              { col1: 'Name' },
              { col2: 'Domain' },
              { col3: 'Expiration' },
              { col4: 'Description' }
            ],
            blocks: [
              {
                title: 'Cookie usage',
                description: 'We use cookies to ensure the basic functionalities of the website and to enhance your online experience. You can choose for each category to opt-in/out whenever you want. For more details relative to cookies and other sensitive data, please read the full <a href="#">Privacy Policy</a>.'
              }, {
                title: 'Necessary',
                description: 'These cookies are essential for the proper functioning of our website. Without these cookies, the website would not work properly',
                toggle: {
                  value: 'necessary',
                  enabled: true,
                  readonly: true          // cookie categories with readonly=true are all treated as "necessary cookies"
                }
              }, {
                title: 'Analytics',
                description: 'These cookies allow the website to remember the choices you have made in the past',
                toggle: {
                  value: 'analytics',     // your cookie category
                  enabled: false,
                  readonly: false
                },
                cookie_table: [           // list of all expected cookies
                  {
                    col1: '^_ga',         // match all cookies starting with "_ga"
                    col2: 'google.com',
                    col3: '2 years',
                    col4: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.',
                    is_regex: true
                  }, {
                    col1: '_gid',
                    col2: 'google.com',
                    col3: '1 day',
                    col4: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.',
                  }
                ]
              }, {
                title: 'Advertising',
                description: 'These cookies collect information about how you use the website, which pages you visited and which links you clicked on. All of the data is anonymized and cannot be used to identify you',
                toggle: {
                  value: 'advertising',
                  enabled: false,
                  readonly: false
                },
                cookie_table: [             // list of all expected cookies
                  {
                    col1: '_name',
                    col2: 'xyz.com',
                    col3: '2 weeks',
                    col4: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.',
                    is_regex: true
                  }, {
                    col1: '_name',
                    col2: 'xyz.com',
                    col3: '3 days',
                    col4: 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat.',
                  }
                ]
              }, {
                title: 'More information',
                description: 'For any queries in relation to our policy on cookies and your choices, please <a href="#yourcontactpage">contact us</a>.',
              },

            ]
          }

        }
      }

    });
  });
</script>

块/管理脚本

将任何想要管理的脚本标签的 type="text/plain"data-cookiecategory="<category>" 设置为。在“初始化”脚本之后,在“页脚信息”小部件中的“自定义HTML”小部件内使用内联脚本。

<!-- Google Analytics -->
<script type="text/plain" data-cookiecategory="analytics">
  // Code goes here
</script>

<!-- Advertising -->
<script type="text/plain" data-cookiecategory="advertising">
  // Code goes here
</script>

打开首选项模态框

通过点击“接受全部”、“拒绝全部”或“保存首选项”按钮,cookie bs_cookie_settings 被设置为您的首选项,并隐藏横幅和模态框182天。要再次打开首选项模态框,请将以下链接添加到您的隐私政策中,并添加到页脚小部件中的“自定义HTML”小部件中。

链接

<a data-bs-toggle="modal" href="#bs-cookie-modal">Cookie Preferences</a>

按钮

<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#bs-cookie-modal">Cookie Preferences</button>

许可证 & 致谢