這個外掛並未在最新的 3 個 WordPress 主要版本上進行測試。開發者可能不再對這個外掛進行維護或提供技術支援,並可能會與更新版本的 WordPress 產生使用上的相容性問題。

Easy Cookie Law

描述

Easy Cookie Law helps you to easily comply with the European cookie law. It shows a customizable notice to the user until he accepts or declines the use of cookies in your website.
The message, position, and style of this notice can be easily modified through the plugin menu.

This plugin is good for your SEO since it will not add any CSS stylesheet or Javascript file. Everything is inline and kept to a minimum (<2KB).

It is also totally compatible with any cache plugin since only JavaScript code is responsible checking if the user already accepted the use of cookies, to show and to hide the banner, without any use of PHP, so your websites can be cached to HTML without a problem.

If you use Google Tag Manager, you can put the required scripts on your website directly with this plugin.

For detailed information see Easy Cookie Law WordPress Plugin.

螢幕截圖

  • Easy Cookie Law Options Menu

安裝

  1. Upload ‘easy-cookie-law’ folder to the ‘/wp-content/plugins/’ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Configure the plugin throught Settings -> Easy Cookie Law

常見問題

How does it work?

When a user visits your site, the plugin will check if this user has already accepted the use of cookies, (using a session cookie). If the user has not this cookie, a message will be shown (you can configure where, how and what will be shown). If the users keep surfing
in your web, now or within the next month, it means that he accepted the use of cookies in your website, so this message will not be shown again.

For detailed information see Easy Cookie Law WordPress Plugin.

Why am I not seeing the message?

Probably, you already have visited the site before, so you accepted the use of cookies and the plugin installed a cookie in your browser to know it. If you want to test if the plugin is working properly, try removing the cookies of your web browser or navigating in incognito mode.

For detailed information see Easy Cookie Law WordPress Plugin.

How do I block some scripts of loading or using cookies until cookes are accepted

If you are using Google Tag Manger, you just have to put the code on your website using our Plugin (go to Settings -> Easy Cookie Law).
If you are usiny any other scripts, you can wrap them within the JavaScript function ecl_is_cookie_accepted() like this:

<script>
    if(ecl_is_cookie_accepted()){
        .. your JS Code here ..
    }
</script>

Please, make sure you are calling this function somwhere after after the wp_head() WordPress function. For instance, you can use it within the <body></body> tags.

If this JavaScript code is not working or you prefer to use PHP code, you can also use this function within your theme:

<?php if(function_exists('ecl_is_cookie_accepted') && ecl_is_cookie_accepted()): ?>
    .. your JS Code here ..
<?php endif; ?>

評價

2019年2月13日
This plugin really helped us, not only with the cookies but also with the SEO of the site, since the load time of the website is not being influenced at all with this plugin.
閱讀全部4個評價

貢獻者及開發者

“Easy Cookie Law” 是一個開源的軟體。以下的人對這個外掛作出了貢獻。

貢獻者

將 Easy Cookie Law 外掛本地化為台灣繁體中文版。

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

修改日誌

3.1

  • Fixed a minor JS Bug when leaving scripts in blank

3.0

  • Added option to decline cookies
  • Improved management of cookies, scripts and notice

2.9

  • Fixed bug on accepting on scroll

2.8

  • Added accepting cookies on scroll

2.7

  • Close notice without reloading

2.6

  • Added more styling options

2.5

  • Added textarea for custom styles

2.4

  • Added check of user roles
  • Fixed some PHP Warnings (Thanks to Łukasz Muchlado)

2.3

  • Fixed some small JavaScript bugs

2.2

  • Added support for Google Tag Manager
  • Added some translations

2.1

  • Bug fix on JavaScript
  • Refactoring of code
  • Link target option added

2.0

  • Minor JavaScript improvements

1.9

  • Bug fix on php version

1.8

  • Some minor bug fixes

1.7

  • Bugfix in output string (Thanks to Giomba)

1.6

  • Updated to WordPress v4.9

1.5

  • Updated to WordPress v4.6

1.4

  • Updated to WordPress v4.3

1.3

  • Updated to WordPress v4.2.1

1.0

  • First published version.