=== ShieldPage Cookie Consent ===
Contributors: shieldpage
Tags: cookie consent, gdpr, cookie banner, consent mode, privacy
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

GDPR / ePrivacy cookie consent that blocks known trackers before consent. Google Consent Mode v2, GPC, consent records. Free for one site.

== Description ==

ShieldPage Cookie Consent installs the ShieldPage consent widget as the first script in your page head — the only position from which tracker blocking actually works.

What the widget does on your site:

* Shows a consent banner with Accept / Reject of equal prominence and granular categories (the CNIL / EDPB expectation).
* Holds Google Analytics, Google Tag Manager, Meta Pixel, Hotjar, HubSpot, LinkedIn, TikTok and 30+ other known tags until the matching category is accepted — including tags injected later by JavaScript.
* Sends Google Consent Mode v2 signals (denied by default, updated on choice).
* Honours Global Privacy Control, and shows US visitors a "Do Not Sell or Share" link.
* Deletes tracker cookies when consent is withdrawn.
* Records each consent decision so you can demonstrate it (GDPR Art. 7(1)); visitors can view and delete their own record from the banner.
* Auto-detects the visitor's language (15 languages).

Banner texts, colours, categories and the cookie inventory are managed in the ShieldPage dashboard, which also runs a monthly compliance sweep of your site on paid plans. The Free plan covers one website with no pageview cap.

This plugin is a thin installer: it prints one `<script>` tag and gives you a `[shieldpage_preferences]` shortcode for a "Cookie settings" link. It stores no visitor data in WordPress and adds nothing to your database beyond one settings row.

= Third-party service =

This plugin relies on ShieldPage, a hosted consent-management service operated by Devspace HUB SRL (Romania). A ShieldPage account (free tier available) is required.

* The consent script is loaded by your visitors' browsers from `https://api.shieldpage.com/sp.js` on every front-end page once a site ID is configured.
* When a visitor makes a choice in the banner, their browser sends that choice to ShieldPage: the accepted/rejected categories, the time, the banner configuration version, a random visitor identifier (stored in the consent cookie), the visitor's country derived from their IP address (the IP address itself is not stored), and the browser user agent. This is what lets you demonstrate consent under GDPR Art. 7(1).
* Your WordPress server itself makes no requests to ShieldPage. The plugin sends no data about your site, your users or your administrators.
* Terms of service: https://shieldpage.com/terms — Privacy policy: https://shieldpage.com/privacy

The plugin adds suggested wording to Settings → Privacy → Policy Guide so you can disclose this in your own privacy policy.

== Installation ==

1. Create a free account at https://app.shieldpage.com and add your website under Consent.
2. Upload and activate the plugin.
3. Settings → Cookie Consent: paste your site ID (the `data-site` value from the Install page). Leave "Block known trackers" and "Consent Mode v2" on.
4. Add `[shieldpage_preferences]` to your footer so visitors can change their choice.
5. Open your site in a private window and confirm no analytics/marketing cookies are set before Accept — then run https://shieldpage.com/free-cookie-scanner.

Note: analytics tags hard-coded in a theme ABOVE `wp_head()` run before any plugin can act. Remove them and let the widget govern them, or move them below `wp_head()`.

== Frequently Asked Questions ==

= Does this make my site GDPR compliant? =
It implements the consent mechanics the law asks for. Compliance also depends on your cookie policy, privacy policy and what you actually run — ShieldPage's dashboard and scans help you keep those aligned, but no plugin can guarantee compliance.

= Does it work with Google Analytics 4 / GTM / Meta Pixel? =
Yes — they are blocked until consent and released per category. Consent Mode v2 signals are sent automatically.

= Does it support the IAB TCF framework? =
No. ShieldPage is not a TCF-registered CMP. Sites that must pass TCF strings to ad-tech partners need a TCF CMP.

= Where are consent records stored? =
In ShieldPage (Cloudflare, EU jurisdiction), for the retention period you configure — not in your WordPress database.

= Does it work with a Content-Security-Policy? =
Yes. The loader is printed through WordPress's script-tag API, so CSP-nonce plugins can add their nonce, and the "Cookie settings" link uses no inline event handler. Allow `https://api.shieldpage.com` in `script-src` and `connect-src`.

= Can I change the API host? =
Only to another host under shieldpage.com (for staging). The field refuses anything else, so the setting can never be used to load third-party scripts. Developers can widen the allow-list with the `shieldpage_consent_allowed_hosts` filter.

= Does the plugin work with caching plugins? =
Yes. The script tag is static per site and safe to cache; consent state lives in the visitor's browser.

== Changelog ==

= 1.0.1 =
* Security: the API base setting is restricted to https hosts under shieldpage.com (filterable), so the setting cannot load arbitrary scripts.
* The loader is printed via `wp_print_script_tag()` (CSP-nonce compatible) and skipped on feeds, embeds and REST responses.
* The `[shieldpage_preferences]` link no longer uses an inline `onclick`; a small footer script handles the click. New `class` attribute.
* Site ID field accepts a pasted snippet and extracts the `data-site` value.
* Preconnect resource hint for the API host.
* Suggested privacy-policy text added to Settings → Privacy → Policy Guide.
* Third-party service disclosure in this readme and on the settings page.

= 1.0.0 =
* Initial release: snippet installer, settings page, preferences shortcode.

== Upgrade Notice ==

= 1.0.1 =
Security hardening of the API base setting and CSP-friendly output. Recommended for all users.
