=== Keksitbot - Cookie Consent ===
Contributors: idea4me
Tags: cookie consent, gdpr, consent mode, cookie banner, cookies
Requires at least: 6.0
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

Cookie consent banner with Google Consent Mode v2, script blocking until consent, consent log and an automatic cookie declaration.

== Description ==

Keksitbot connects your WordPress website to the Keksitbot consent service (keksitbot.pl). The plugin adds the Keksitbot script as the first element of `<head>`, so the banner and Google Consent Mode v2 defaults are ready before Google Tag Manager or any other tag loads.

What you get:

* Cookie banner in Polish, English and German, styled in the Keksitbot panel.
* Google Consent Mode v2 (default "denied" in the EEA, UK and Switzerland, update after the decision).
* Scripts and embeds (YouTube, maps) wait until the visitor agrees.
* Consent log kept as proof of consent (anonymous consent ID, time, categories, shortened IP hash).
* Cookie declaration for the privacy policy, kept up to date by the Keksitbot scanner: `[keksitbot_deklaracja]` shortcode or the "Cookie declaration" block.
* "Privacy settings" link that lets visitors change or withdraw consent: `[keksitbot_ustawienia]` shortcode, block, classic widget or menu item.
* Works with optimization plugins: the script is excluded from delaying, deferring and combining in WP Rocket, LiteSpeed Cache, Autoptimize, SiteGround Speed Optimizer, Jetpack Boost, WP Fastest Cache and Cloudflare Rocket Loader. The page cache is cleared after you save the settings.
* WP Consent API integration: plugins that use `wp_has_consent()` know what the visitor allowed.
* WooCommerce: order attribution (sbjs_ cookies) only after marketing consent. Cart and checkout work without consent. WooCommerce is not required.
* Scripts enqueued by the theme or other plugins can wait for consent by their handle (Settings - Keksitbot - "Scripts that wait for consent").

You need a Keksitbot account: create a site in the Keksitbot panel and copy its site ID into Settings - Keksitbot.

== External services ==

This plugin connects your website to the Keksitbot consent service, operated by idea4me.pl sp. z o.o. (ul. Składowa 5, 62-023 Żerniki, Poland). Without it the plugin does nothing.

* On every front-end page the visitor's browser loads the script `cmp.js` and the banner configuration from the Keksitbot server (default `https://zgody.idea4me.pl`, configurable in the settings). Sent: the site ID, the page address (as the HTTP Referer/Origin) and standard request data (IP address, browser).
* When the visitor makes a decision, the browser sends a consent record to the server: an anonymous consent ID, the chosen categories, the type of decision, banner version, language and the page path without parameters. The server stores only a shortened hash of the IP address and a short browser name ("Chrome 141 / Windows"), never the full IP address.
* The cookie declaration (shortcode or block) is loaded from the same server.
* When an administrator clicks "Check the connection" in the settings, WordPress requests the public banner configuration for the site ID from the server.

Terms of service: https://keksitbot.pl/regulamin
Privacy policy: https://keksitbot.pl/prywatnosc

== Installation ==

1. Install and activate the plugin.
2. In the Keksitbot panel add your website and open "Installation". Copy the site ID (the value of `data-id` in the code).
3. In WordPress go to Settings - Keksitbot, paste the site ID and save. Click "Check the connection".
4. Remove any code of Keksitbot you added earlier by hand (theme header, header code plugin or Google Tag Manager): the script should be on the page once.
5. Put `[keksitbot_deklaracja]` on your privacy policy page and a "Privacy settings" link in the footer or menu.
6. Mark scripts pasted into the HTML that need consent: `<script type="text/plain" data-zgoda="statystyka">`. Categories: `preferencje`, `statystyka`, `marketing`.

== Frequently Asked Questions ==

= Where do I find the site ID? =

In the Keksitbot panel: your website - Installation. It is the value of `data-id` in the code, for example `3f9a1c2b7d4e`.

= Can I keep Keksitbot in Google Tag Manager? =

Use one way only. The plugin loads the script directly in `<head>`, before Google Tag Manager, which is the most reliable for Consent Mode. If the script is loaded twice, the second copy does nothing and the panel shows a "Code twice" badge.

= My cache or optimization plugin delays scripts. =

The plugin adds the script to the exclusion lists of popular optimization plugins and marks the tag with the attributes they respect. Clear the cache after saving the settings. If you use another plugin, exclude `cmp.js` from "delay JavaScript", "defer" and "combine" by hand.

= How do I add the "Privacy settings" link to a block theme menu? =

In the Navigation block add a "Custom link" with the address `#zgody-ustawienia`. In classic themes use Appearance - Menus - box "Keksitbot" (if you do not see it, turn it on in Screen Options at the top of the page).

= Does it work with WooCommerce? =

Yes, without extra plugins. Order attribution starts only after marketing consent; cart, checkout and login cookies are necessary and are not blocked.

= What happens when I delete the plugin? =

The plugin settings are removed from WordPress. Consent records stay in the Keksitbot service as proof of consent; manage them in the Keksitbot panel.

= For developers =

Filters: `keksitbot_print_script` (bool, print the script on the current page), `keksitbot_script_attributes` (array, tag attributes; async and defer are always removed), `keksitbot_script_categories` (array, handle => category of enqueued scripts that wait for consent). Constant `KEKSITBOT_DEFAULT_SERVER` in wp-config.php changes the default server. JavaScript API: `window.Keksitbot` (also `window.__cmp`), event `zgody:zmiana`, dataLayer event `zgody_aktualizacja`.

== Screenshots ==

1. Settings - Keksitbot: site ID, banner switch, language, server address and the connection check.
2. Scripts that wait for consent and integrations with WP Consent API and WooCommerce.
3. "Privacy settings link" and "Cookie declaration" blocks in the editor.
4. The Keksitbot banner on the website.

== Changelog ==

= 1.0.0 =
* First version: script as the first element of head, settings and connection check, cookie declaration and privacy settings link (shortcodes, blocks, widget, menu), optimization plugin exclusions, WP Consent API and WooCommerce integration, scripts waiting for consent by handle. Translations: Polish, German.

== Upgrade Notice ==

= 1.0.0 =
First version.
