=== AE Cookies – LGPD Cookie Consent ===
Contributors: aepress
Tags: cookies, lgpd, gdpr, consent, cookie banner
Requires at least: 6.9
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Cookie consent for LGPD and GDPR: blocks scripts until consent, Google Consent Mode v2, cookie scanner, consent records and step-by-step setup.

== Description ==

AE Cookies shows a cookie banner and makes sure third-party tools only run after the visitor agrees. It is free, works with any theme and page cache, and sends no data to outside services.

**Built for the Brazilian LGPD (Law 13.709/2018) and the GDPR**

* "Accept" and "Reject" buttons with the same weight, plus "My options": choose by category (necessary, functional, analytics, marketing) or service by service (for example, allow Google Analytics but not Hotjar). Each service shows its cookies with purpose and expiration.
* Third-party scripts and embeds are blocked until consent: Meta Pixel, TikTok, Microsoft Clarity, Hotjar, LinkedIn, Pinterest, RD Station, HubSpot, YouTube, Vimeo, Google Maps and more.
* Google Consent Mode v2 built in: Google Tag Manager, GA4 and Google Ads start with consent denied and are updated after the choice.
* Consent records as proof of each choice, with an anonymous id. No IP address, name or e-mail is stored. Export to CSV.
* The choice expires (default 180 days, at most one year) and you can ask every visitor again with one click.
* Controller and data protection officer (encarregado) shown in the preferences, as the LGPD requires.

**Step-by-step setup**

After activation, a short setup guides you through company data, legal links (privacy policy, terms of use and an automatic cookie policy page), banner format, colors and texts, integrations and the first scan.

**Banner formats**

Bar at the bottom or at the top, box in the bottom left or right corner, or a centered window with an optional dark background. A floating button (left or right) lets visitors change their choice at any time. Colors, rounded corners, logo and every text are editable, with a live preview.

**Cookie scanner**

The scanner reads your own pages (home, legal pages and recent content), finds known services and lists their cookies with provider, purpose and duration. It can run every 24 hours or weekly. Cookies created by JavaScript are learned from visits after consent: the browser reports only the cookie names, never their values.

**Integrations**

* Google Consent Mode v2 and the `ae_cookies_consent` event in the Google Tag Manager dataLayer (with the categories and the services the visitor turned off).
* WP Consent API, used by WooCommerce, Site Kit and other plugins.
* Works with WP Rocket, Autoptimize and LiteSpeed Cache (the consent scripts are excluded from delay and combination).

**Shortcodes**

* `[ae_cookie_policy]` – full cookie policy with the cookie table.
* `[ae_cookie_table]` – the cookie table only.
* `[ae_cookie_preferences text="Change my cookies"]` – button that opens the preferences. A link to `#aepc-preferences` does the same.

**For developers**

* JavaScript: `AECookies.open()`, `AECookies.has('analytics')`, `AECookies.get()` and the `aecookies:consent` event on `document`.
* Filters: `aepc_services` (add or change known services), `aepc_script_category` (decide which category a script waits for) and `aepc_process_page` (skip blocking on a request).
* To keep a script out of the blocker, add the `data-aepc-ignore` attribute to its tag.

The plugin helps you comply with the law but is not legal advice. Review your privacy policy with a professional.

== Installation ==

1. Install from Plugins › Add New, or upload the `ae-cookies` folder to `/wp-content/plugins/`.
2. Activate the plugin. The step-by-step setup opens.
3. Follow the steps and turn the banner on in the last one. Until then, only administrators see it, through the preview link.

== Frequently Asked Questions ==

= Does it work with page cache? =

Yes. The banner is the same for everyone and the decision happens in the visitor's browser, so cached pages work normally.

= My tags are in Google Tag Manager. What do I need to do? =

Keep Google Consent Mode on: Google tags respect the choice by themselves. For other tags inside GTM (Meta Pixel, TikTok, Clarity…), add the additional consent check to each tag, or fire them on the custom event `ae_cookies_consent` with the variable `ae_cookies_consent.marketing` equal to true.

= Does the plugin send data anywhere? =

No. The scanner only reads your own site, the consent records stay in your database and the banner files are served by your site.

= What is stored in the consent records? =

An anonymous id (also kept in the visitor's cookie), the date, the choice, the accepted categories, the policy version and the page path. No IP address, name or e-mail.

= How do I remove the plugin completely? =

Deactivating keeps the settings. Deleting the plugin from the Plugins screen removes its settings, cookie list and consent records.

== Screenshots ==

1. Step-by-step setup: company, legal links, banner, colors, categories, scan and activation.
2. The visitor decides: accept, reject or choose by category.
3. Preferences by category, with the cookies each one uses.
4. Overview with the LGPD compliance checklist.
5. Cookie list found by the scanner, with review for names reported by visitors.

== Privacy ==

This plugin stores the visitor's choice in the `ae_cookies_consent` cookie (first party). When consent records are on, it saves an anonymous record of the choice in your database. When "Learn cookies from visits" is on, the visitor's browser sends to your own site the names (not the values) of the cookies it has, after consent. No data is sent to the plugin authors or to any other service.

== External services ==

This plugin does not connect to any external service and does not send data to the plugin authors or to anyone else.

* The list of known services in `includes/class-services.php` (Google Analytics, Google Tag Manager, Google Ads, Meta Pixel, Google Maps, Tawk.to and others) holds only address and code patterns. The plugin uses them to recognize the scripts and embeds the site already has, hold them until the visitor consents and describe their cookies in the banner and the cookie policy. It never loads those services by itself; when the visitor consents, the scripts the site owner added load as they would without the plugin, under the terms of each provider.
* The cookie scanner, run by an administrator, requests pages of the site itself (the site's own address, optionally through 127.0.0.1) to find cookies and scripts. Nothing goes to other hosts.
* When "Learn cookies from visits" is on, the visitor's browser sends cookie names (never values) only to the site's own REST API. Those names wait for the administrator's review before they appear anywhere.
* The optional "AEPress" credit link in the banner, off by default, is a plain link to https://aepress.com.br/ and sends nothing unless the visitor clicks it.

== Changelog ==

= 1.0.6 =
* Fix: themes that set a margin on every element no longer center or shift the items of the preferences window.
* Fix: on the Banner tab, the title, message and button texts were not saved (an empty hidden copy overwrote them).
* The credit option in the settings and setup now names "AEPress", matching the link shown in the banner.

= 1.0.5 =
* The optional credit link shows "AEPress", the plugin author.
* Overview: card to leave a review, get support and see more plugins by AEPress.

= 1.0.4 =
* Fix: themes that style every header and footer element (dark background, white text) no longer change the preferences window.

= 1.0.3 =
* Plugin name in English: "AE Cookies – LGPD Cookie Consent" (Portuguese sites keep "Consentimento LGPD" through the translation).

= 1.0.2 =
* Plugin site and Support links on the Plugins screen; the settings header links to the support forum.

= 1.0.1 =
* New icon in the AEPress visual identity (menu, settings header and floating button).

= 1.0.0 =
* First release.
