=== BerryCookie – Cookie Consent ===
Contributors: berrycookie
Tags: cookie banner, gdpr, cookie consent, consent mode, cookies
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

GDPR cookie banner with script blocking, a consent log, cookie scanning and Google Consent Mode v2.

== Description ==

BerryCookie adds a cookie consent banner to your site and keeps tracking scripts from running until visitors agree.

* Banner and preference center in 12 ready-made languages, including English, Romanian, German, French, Spanish and Italian, plus any texts you write yourself.
* Automatic blocking of the trackers your BerryCookie scans find on the site and of well-known ones (Meta Pixel, LinkedIn, TikTok, Hotjar and more), or manual blocking with `data-bc-category`. Google tags receive Consent Mode signals instead; payment, captcha and library scripts are never blocked.
* Google Consent Mode v2 signals for Google Analytics and Google Ads.
* Rules per region: ask for consent in the EU, inform elsewhere.
* A consent log, and a monthly cookie scan that fills in your cookie declaration.
* Works with the WP Consent API, so plugins that follow it respect the visitor's choice.
* Loads first in `<head>` and stays out of the way of caching and optimisation plugins (WP Rocket, LiteSpeed Cache, W3 Total Cache, Autoptimize, SiteGround Optimizer, WP Fastest Cache, Cloudflare Rocket Loader).

The banner is designed, and consents are recorded, in your BerryCookie account. A free plan is available; on the free plan the banner shows a small "Powered by BerryCookie" link, paid plans do not. This plugin does not lock any of its own settings behind a paid plan.

The plugin's source code is the readable PHP and JavaScript in this package; nothing is minified or obfuscated.

== Installation ==

1. Install and activate the plugin.
2. Open Settings → BerryCookie and click "Create a free account" (or sign in at https://app.berrycookie.com), add your site and verify the domain.
3. In the BerryCookie dashboard open Websites → Install and copy the website key.
4. Paste the key in Settings → BerryCookie and save.
5. Publish the banner in the BerryCookie dashboard.

Add `[berrycookie_settings]` to your footer or cookie policy, or a menu item with the address `#berrycookie-settings`, so visitors can change their choice.

== Frequently Asked Questions ==

= Does the plugin do anything before I add a website key? =

No. Until a valid website key is saved, nothing is added to your pages and no external service is contacted. A notice on the Dashboard and the Plugins screen reminds administrators to finish the setup; it disappears once the key is saved.

= What does "Check your website" do? =

It opens the public BerryCookie scanner in a new tab, with your site address in the link, so you can see the cookies and trackers your public pages set. Nothing is sent unless you click the button.

= I use Google Tag Manager =

Use the BerryCookie template in Tag Manager instead of this plugin, or set Script blocking to Manual here. Load BerryCookie one way only.

= My caching or optimisation plugin delays the banner =

The banner script must run first, before any tracker, so it may not be delayed, deferred, combined, minified or lazy-loaded. The plugin prints it as a plain synchronous tag at the very top of `<head>` and handles the common optimisers for you:

* **Cloudflare Rocket Loader**: the tag carries `data-cfasync="false"` before `src`, which Rocket Loader skips.
* **WP Rocket**: the script is added to the exclusions of "Minify / combine JavaScript" (`rocket_exclude_js`), "Load JavaScript deferred" (`rocket_exclude_defer_js`) and "Delay JavaScript execution" (`rocket_delay_js_exclusions`), and the tag carries `data-no-minify`.
* **LiteSpeed Cache**: the script is added to JS Excludes, JS Deferred / Delayed Excludes and Guest Mode JS Excludes (`litespeed_optimize_js_excludes`, `litespeed_optm_js_defer_exc`, `litespeed_optm_gm_js_exc`).
* **W3 Total Cache**: the tag is kept out of JS minification (`w3tc_minify_js_do_tag_minification`).
* **Autoptimize**: the script is added to "Exclude scripts from Autoptimize" (`autoptimize_filter_js_exclude`).
* **SiteGround Optimizer**: the BerryCookie host is excluded from JavaScript combination (`sgo_javascript_combine_excluded_external_paths`).
* **WP Fastest Cache**: the tag carries `data-wpfc-render="false"`, which "Render Blocking Js" leaves in place.

If the banner still loads late, add `cdn.berrycookie.com/bc.js` by hand to your optimiser's exclusion lists, then clear its cache:

* WP Rocket: File Optimization → Excluded JavaScript Files, and Delay JavaScript execution → Excluded JavaScript Files.
* LiteSpeed Cache: Page Optimization → Tuning → JS Excludes, JS Deferred / Delayed Excludes and Guest Mode JS Excludes.
* W3 Total Cache: Performance → Minify → Advanced → Never minify following JS files.
* SiteGround Optimizer: Frontend → JavaScript → exclusion lists for Minify, Combine and Defer.
* Other plugins or a CDN that delays scripts: any "exclude from defer / delay / combine" setting.

Also check that your theme calls `wp_head()` before any tracking code in its header.

= Does the plugin slow down my site? =

The script is under 9 kB compressed, served from a CDN, and loads the banner configuration once per page. It is printed synchronously on purpose: a consent tool that loads late cannot stop the trackers that run before it.

= Does the banner show a BerryCookie link? =

On the free plan the banner shows a small "Powered by BerryCookie" link, added by the BerryCookie service (not by this plugin). Paid plans do not show it.

= Can I change the script tag? =

Use the `berrycookie_script_attributes` filter.

= What happens to my settings when I delete the plugin? =

Deleting the plugin from the Plugins screen removes its settings from the database. Your banner, cookie declaration and consent log stay in your BerryCookie account.

== External services ==

This plugin connects your site to BerryCookie (https://berrycookie.com), a consent management service operated by BerryCookie. It is needed to show the cookie banner, to block trackers until consent and to keep proof of consent for the site owner. Nothing is loaded until the site owner saves a website key in Settings → BerryCookie.

* **Banner script** – on every public page the visitor's browser loads `bc.js` from `https://cdn.berrycookie.com` (or the script URL set under Advanced). The CDN receives the usual request data: IP address, browser user agent and the page that loaded it.
* **Banner settings** – the script then fetches the banner configuration for the website key from `https://consent.berrycookie.com` (or the Consent API URL set under Advanced), with the visitor's country derived from the IP address so regional rules apply. When the banner is shown, an anonymous impression count is sent.
* **Consent record** – when a visitor makes a choice, the choice, a random visitor ID, the banner version, the language, the page address, the browser user agent and an anonymized IP address are sent to `https://consent.berrycookie.com` and kept as proof of consent for the site owner. The choice is also stored in the first-party cookie `BerryCookieConsent` on your site.
* **Links in the admin** – "Create a free account" opens `https://berrycookie.com/register` and "Check your website" opens the public scanner at `https://berrycookie.com` with your site address in the link. They are only followed when an administrator clicks them.

Terms of use: https://berrycookie.com/en/terms (Romanian: https://berrycookie.com/ro/termeni)
Privacy policy: https://berrycookie.com/en/privacy (Romanian: https://berrycookie.com/ro/confidentialitate)
Documentation: https://berrycookie.com/en/docs/wordpress (Romanian: https://berrycookie.com/ro/documentatie/wordpress)

== Screenshots ==

1. Settings → BerryCookie: website key, script blocking and Google Consent Mode.
2. The cookie banner on a site.

== Changelog ==

= 1.0.0 =
* First release: banner script first in `<head>`, website key settings, Google Consent Mode v2, WP Consent API bridge, cookie settings shortcode, exclusions for caching and optimisation plugins, "Check your website" button. Translations through translate.wordpress.org.

== Upgrade Notice ==

= 1.0.0 =
First release.
