=== SUDS Planner ===
Contributors: sudsmedia
Tags: preview, draft, review, ai crawlers, analytics
Requires at least: 5.6
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Public draft preview with a review bar, AI crawler visit counts and a form-submitted Analytics event, connected to SUDS Planner.

== Description ==

SUDS Planner is the content planning tool of the SUDS agency. This plugin connects a client's WordPress site to the Planner:

* **Public draft preview**: a link with a secret code shows that specific unpublished article (draft, pending or scheduled) to anyone who has the link, with the site's normal layout (Elementor included), without logging in.
* **Review bar**: on that preview, the client selects a passage of the text and comments on it, approves the article or requests changes. Everything goes to the post in the Planner.
* **Comments in the editor**: the client's comments are stored with the article (meta box "Client comments (SUDS Planner)"), visible to whoever edits the text.
* **AI crawler visits**: counts the visits of AI crawlers and fetchers (ChatGPT, Claude, Perplexity, Mistral, Meta AI and others, by user agent) per day and page, in its own table. It stores only the day, the crawler name, the page path and the count; nothing about visitors. SUDS Planner reads the counts with the site token for the client's SEO report.
* **Form submitted event**: when a form is submitted successfully (Elementor, Contact Form 7, WPForms, Gravity Forms, Fluent Forms, Forminator), sends the `formulario_enviado` event to Google Analytics already on the site (gtag, or the Tag Manager dataLayer), with only the form tool and form id. It can be turned off in Settings → SUDS Planner.

The plugin does not change content and does not publish anything on its own: scheduled publishing is done by the Planner through the WordPress REST API, with an application password.

= External service =

The review bar is shown only on a draft preview opened with the client's link (the preview code plus, at the end of the address, `#suds_review=...`). It sends the reader's comments and decisions to the SUDS Planner address configured in the plugin (https://planner.suds.com.br). The AI crawler counts stay on the site and are read only by SUDS Planner with the site token. The form event goes only to the Google Analytics the site already uses; the plugin does not load Analytics and sends nothing that visitors typed. Terms: https://suds.com.br.

== Installation ==

1. Upload the zip file in Plugins → Add New → Upload Plugin and activate it.
2. In Settings → SUDS Planner, paste the token shown in the client's record in the Planner (the zip downloaded from that record already includes the token).
3. In the Planner, under Connected accounts → WordPress, click Test connection.

== Frequently Asked Questions ==

= Is the preview public to anyone? =

Only to whoever has the link with the article's secret code, and only for that article. Unpublished pages stay invisible to the rest of the site and to search engines (noindex, no cache).

= Does the plugin publish the article? =

No. Scheduled publishing is done by SUDS Planner through the WordPress REST API, using the application password of the user configured there.

== Changelog ==

= 1.3 =
* AI crawler visits per day and page (REST /suds/v1/bots, with the token) for the SEO report.
* Google Analytics event formulario_enviado on successful form submissions (can be turned off in the settings).

= 1.2 =
* Scripts and styles of the review bar moved to files and loaded with wp_enqueue_script / wp_enqueue_style.

= 1.1 =
* Preview restricted to the article of the code; review token kept out of the page address; fixed Planner address.

= 1.0 =
* Public draft preview, review bar and client comments mirrored in the editor.
