=== GDPR Privacy Monitor ===
Contributors: lkontur
Tags: gdpr, cookie consent, cookie scanner, cookie banner, privacy
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Cookie consent checker: see your site's GDPR risk score in WP admin, re-scan after plugin updates and get alerts when it gets worse.

== Description ==

Cookie banners and consent tools often break silently after a plugin or theme update: a tracker starts loading before consent, or the Reject button stops working. GDPR Privacy Monitor is a cookie scanner and consent checker: it tests your cookie banner on the live site in a real browser, the way a visitor sees it, and reports what it finds, such as cookies set before consent or tracking that continues after Reject.

This plugin connects your WordPress site to your GDPR Privacy Monitor account. It works on every plan, including Free, within your plan's scan quota and monitored-site limit.

* **Dashboard widget and settings page** showing the latest risk score (0 to 100, higher means more risk), how it changed since the previous scan, the risk level and the findings for your site.
* **Monitoring and alerts.** If your site is monitored in your account, the plugin finds the monitor and links every scan it starts to it, so a scan that is worse than the one before triggers an alert by email or Slack (as set up in your account). If it is not monitored yet, one click on "Enable monitoring for this site" creates the monitor (weekly scans on the Free plan).
* **Re-scan after changes.** When plugins, themes or WordPress itself are updated, a plugin is activated or deactivated, or the theme is switched, the plugin schedules one scan about 10 minutes later via WP-Cron, so the change is not slowed down and a batch of changes results in a single scan.
* **Change notes on the monitor timeline.** Before that scan, the plugin records what changed (for example "WordPress: updated Yoast SEO 23.1 → 23.2; deactivated Complianz") as a release marker on the monitor, so you can see which change came before a regression. You can turn this off.
* **Scan now** button for on-demand scans.
* **Link to the full report** in the GDPR Privacy Monitor web app (evidence, fix guidance, PDF export).

The scan itself runs on the GDPR Privacy Monitor service, not on your server. You need a GDPR Privacy Monitor account and an API key with the `scan:read`, `scan:write`, `monitors:read` and `monitors:write` scopes. The settings page links to the key form with these scopes prefilled.

The plugin does not collect analytics about your site or its visitors and adds nothing to your public pages.

== External services ==

This plugin connects to the GDPR Privacy Monitor API (https://gdprprivacymonitor.eu, or the API base URL you configure for a self-hosted or staging deployment). It is needed to start scans of your site, to show their results and to link the site to its monitor.

No request is made until an administrator saves an API key on Settings > GDPR Privacy Monitor. After that:

* When the key or settings are saved, and when an administrator opens the WordPress dashboard or the plugin settings page (results are cached for up to 15 minutes), the plugin looks up the monitor for the configured site URL and requests the latest scan results (`GET /api/v1/monitors`, `GET /api/v1/scan/trend` and `GET /api/v1/scan/{id}`). Sent: the API key, the site URL and the administrator's language code.
* When an administrator clicks "Enable monitoring for this site", the plugin creates a monitor (`POST /api/v1/monitors`). Sent: the API key and the site URL.
* When an administrator clicks "Scan now", or about 10 minutes after a site change (if "Re-scan after changes" is enabled), the plugin queues a scan (`POST /api/v1/scan`). Sent: the API key, the site URL or the ID of its monitor, and the administrator's or site's language code.
* About 10 minutes after a site change, if "Change notes" is enabled (the default) and the site is monitored, the plugin records one release marker on the monitor (`POST /api/v1/monitors/{id}/release-markers`). Sent: the API key and a short text listing the names and versions of the plugins, themes and WordPress version that were updated, activated, deactivated or switched to. Turn "Change notes" off in the settings to stop sending this.

The service then loads the public site URL in a browser to perform the scan. No data about your site's visitors or users is sent by this plugin.

The service is provided by GDPR Privacy Monitor: [Terms of Service](https://gdprprivacymonitor.eu/en/terms), [Privacy Policy](https://gdprprivacymonitor.eu/en/privacy).

== Installation ==

1. Install and activate the plugin.
2. Go to Settings > GDPR Privacy Monitor and click "Create an API key". In your GDPR Privacy Monitor account (any plan, including Free), the key form opens with the `scan:read`, `scan:write`, `monitors:read` and `monitors:write` scopes prefilled.
3. Paste the key on the settings page and save. The plugin checks the connection and shows "Connected" or the exact problem.
4. Click "Enable monitoring for this site" if the site is not monitored yet, and "Scan now" if it has not been scanned yet.

== Frequently Asked Questions ==

= Which plans does the plugin work with? =

All of them: Free, Starter, Pro and Agency. Your plan's limits apply: the monthly scan quota and the number of monitored sites (one on the Free plan, scanned weekly).

= Does the plugin send anything before I enter an API key? =

No. The plugin makes no external requests until an administrator saves an API key.

= What exactly is sent to GDPR Privacy Monitor? =

The API key, the site URL (or the ID of its monitor) and a language code for the report. With "Change notes" on, also the names and versions of the plugins, themes and WordPress version involved in a site change, as a short note on the monitor timeline. No data about your visitors or users is sent. See "External services" for the full list.

= How do alerts work? =

Alerts come from monitoring in your GDPR Privacy Monitor account. When the site is monitored, every scan the plugin starts is linked to the monitor and compared with the previous scan; if it is worse (for example a tracker now loads before consent), you get an alert by email or Slack, depending on your notification settings. The plugin itself sends no emails.

= Does a re-scan run on every single plugin update? =

No. Each change pushes the scheduled scan back by 10 minutes, so a batch of updates causes one scan and one change note. Plain plugin or theme installs do not trigger a scan; activating the new plugin does. You can turn re-scans off in the settings. Developers can change the delay with the `gdprpm_rescan_delay` filter.

= Do automatic re-scans count towards my scan quota? =

Yes. Every scan, manual or automatic, counts towards the monthly scan quota of your plan. If the quota is used up, the plugin shows the message from the service and tries again after the next change.

= What does "The API key is missing a required scope" mean? =

The key was created without one of the four scopes the plugin needs. Keys created for version 0.1 only had `scan:read` and `scan:write`; scans still work with them, but monitoring and change notes need `monitors:read` and `monitors:write`. Create a new key with the link on the settings page.

= Why is no result shown after "Scan now"? =

Scans take a few minutes. Click "Refresh" on the settings page after a while. Results are only shown for the configured site URL (or the URL of its monitor).

= What happens when I uninstall the plugin? =

All plugin options, recorded changes, cached results and scheduled events are deleted. Scan history and monitors in your GDPR Privacy Monitor account are not affected.

== Screenshots ==

1. Settings page with the latest risk score, the change since the previous scan and the findings.
2. Dashboard widget with the risk score, the top findings and the monitoring status.
3. Monitoring section: the site is monitored, alerts are on, and the last change note sent to the monitor timeline.
4. A re-scan scheduled after plugin updates, with the change note that will be sent before it.

== Changelog ==

= 0.2.1 =
* The plugin's homepage link now points to the plugin page, and the Terms of Service and Privacy Policy links in this readme point to the English pages directly. No functional changes.

= 0.2.0 =
* Works on every plan (Free, Starter, Pro, Agency) within the plan's quotas. API keys need the scopes `scan:read`, `scan:write`, `monitors:read` and `monitors:write`.
* Links the site to its monitor and passes the monitor ID on every scan, so scans are compared with the previous one and trigger alerts. New "Enable monitoring for this site" button.
* Change notes: one release marker per batch of changes on the monitor timeline (plugin, theme and WordPress names and versions). Can be turned off.
* Re-scans also after WordPress core updates, plugin activation and deactivation, and theme switches.
* Shows the previous score next to the latest one.
* Saving the key checks the connection and shows "Connected" or the exact problem (wrong key, missing scopes, plan limits).
* "Create an API key" opens the key form prefilled with the needed scopes.
* "Open full report" goes through the login page, so a logged-out browser lands on the report after signing in.
* Fixed: old warnings (for example "The API key was rejected" after a valid key was saved) are cleared when the settings change or a later call succeeds; "a scan is already running" is shown as information, not as an error; each message is shown once.
* Fixed: after switching to a key from another account, the change note sent to the previous monitor is no longer shown. Scan intervals read "daily" and "weekly" instead of "every 1 day" and "every 7 days".

= 0.1.0 =
* First release: API key connection, dashboard widget, settings page with findings, re-scan after plugin/theme updates, link to the full report.

== Upgrade Notice ==

= 0.2.1 =
Link updates only; no functional changes.

= 0.2.0 =
Monitoring, alerts and change notes. Monitoring needs an API key with the monitors:read and monitors:write scopes; create a new key from the settings page if yours only has the scan scopes.
