=== TopSlot AI Visibility ===
Contributors: topslot
Tags: ai, seo, schema, structured-data, aeo
Requires at least: 5.6
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 1.4.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Render your TopSlot AI-visibility fixes into WordPress server-side, and apply approved meta and content recommendations with one-click revert.

== Description ==

TopSlot measures how AI answer engines (ChatGPT, Gemini, Claude, Perplexity) see your brand and generates the fixes that help them cite you. This plugin applies those fixes on a WordPress site.

**Why server-side.** The TopSlot browser pixel only helps AI crawlers that run JavaScript. Many of them do not. This plugin writes the exact same fixes — schema, meta description, freshness signals — directly into the HTML WordPress renders, so every crawler sees them in the raw page.

**What it does**

* On-page fixes: injects your TopSlot JSON-LD schema, meta description, and freshness signals into `<head>`, server-side. It reads the same feed the pixel uses.
* Meta title and description: applies TopSlot recommendations into your existing SEO plugin's own fields (Yoast SEO, Rank Math, and All in One SEO), so there are never duplicate tags; falls back to its own fields when no SEO plugin is present.
* Content deployment: review meta and content recommendations you accepted in TopSlot and apply them from **TopSlot AI Visibility → Content**. Content updates save a WordPress revision so any change is one-click revertible. New pages are created as drafts — nothing is ever auto-published.

**Safe by design**

* On-page rendering never blocks a page load — fixes are cached locally and refreshed hourly in the background.
* Content is sanitized before it is written and every content change is a revision you can revert.
* An API key is only needed for meta and content deployment. On-page fixes work with just a brand ID.

== External services ==

This plugin connects your site to one required third-party service (TopSlot) and one optional third-party service (Microsoft Clarity). Both are described below so you know exactly what data leaves your site and when.

= TopSlot (topslot.ai) =

This plugin is a companion to the TopSlot AI-visibility service (https://topslot.ai). It cannot function without it: the plugin fetches your approved AI-visibility fixes from TopSlot and renders them into your site, and (optionally) deploys the TopSlot attribution pixel.

What is sent to TopSlot, and when:

* On connect (when you click "Connect with TopSlot" or save credentials): your site URL and a short-lived connection code are sent to https://topslot.ai/connect/wordpress and https://topslot.ai/api/wp/connect/exchange to link your brand and retrieve a Brand ID and API key.
* Hourly background refresh and on connect: your Brand ID, site URL, plugin version, WordPress version, and which features you enabled are sent to https://topslot.ai/api/wp/heartbeat; your Brand ID is sent to https://topslot.ai/api/pixel/active-fixes/&lt;brand id&gt; to download your active fixes (schema, meta, freshness signals).
* When you deploy content or meta (Content screen, requires an API key): your Brand ID and API key are sent to https://topslot.ai/api/wp/content-ops to fetch queued operations, and the outcome (operation id, result, the created/updated post ID and URL, and any error) is sent to https://topslot.ai/api/wp/content-ops/ack.
* On every front-end page load, only if you enable the attribution pixel: the script https://topslot.ai/api/pixel/&lt;pixel id&gt;.js is loaded in visitors' browsers. It records anonymous AI-referral / attribution signals for your brand.

No post content is uploaded to TopSlot; content recommendations are generated in TopSlot and downloaded to your site for you to review and apply.

TopSlot Terms of Use: https://topslot.ai/terms
TopSlot Privacy Policy: https://topslot.ai/privacy

= Microsoft Clarity (clarity.ms) — optional =

Only if you enable Clarity in the plugin's Settings screen and provide a Clarity project ID, this plugin loads the Microsoft Clarity script from https://www.clarity.ms/tag/&lt;project id&gt; on every front-end page. Microsoft Clarity is a session-analytics service operated by Microsoft; when active it collects visitor interaction data (such as page views, clicks, scrolls, and session recordings) and sends it to Microsoft. This is disabled by default and is entirely under your control.

Microsoft Clarity Terms of Use: https://www.microsoft.com/en-us/legal/terms-of-use
Microsoft Privacy Statement: https://privacy.microsoft.com/en-us/privacystatement

By connecting your site and enabling these features you agree to the applicable Terms and Privacy Policies linked above.

== Installation ==

1. In your TopSlot dashboard, open **Connectors → WordPress** and copy your **Brand ID** (and, for content deployment, create an **API key** under Settings → API).
2. Upload and activate this plugin, or install the ZIP from **Plugins → Add New → Upload Plugin**.
3. Open the **TopSlot AI Visibility** menu and click **Connect with TopSlot** — sign in, pick your brand, and the Brand ID and API key fill in automatically. (You can also enter them manually under Settings.) To deploy your attribution pixel, paste the pixel snippet from your TopSlot dashboard (Pixel → Install) into the Settings screen.

== Frequently Asked Questions ==

= Do I need an API key? =
Only for meta and content deployment. On-page schema and meta rendering work with just your Brand ID.

= Will this conflict with my SEO plugin? =
No. It detects Yoast SEO and Rank Math and writes into their fields, and it never emits a meta description when your SEO plugin already outputs one.

= Can it break my content? =
Content updates go through WordPress revisions, so any change can be reverted in one click. New pages are created as drafts.

= What data does the plugin send off my site? =
See the **External services** section above. In short: TopSlot receives your Brand ID, site URL, plugin/WordPress versions, and (for content deployment) your API key and the IDs/URLs of posts it updates — never your post content. Microsoft Clarity is off by default and only loads if you enable it and add a project ID.

= What happens when I uninstall the plugin? =
Uninstalling removes the plugin's own options, transients, and scheduled task. Meta titles and descriptions you already applied to your posts are intentionally left in place — they are your content now, and deleting them would silently remove SEO you approved. Remove them manually if you want them gone.

== Changelog ==

= 1.4.1 =
* Added a full **External services** disclosure (TopSlot and optional Microsoft Clarity): what data is sent, when, and links to each service's Terms and Privacy Policy.
* Hardening: the TopSlot URL is now restricted to https, and all saved settings are unslashed before validation.
* Uninstall now also clears one-time connection-state transients. Internationalization: added translator comments to all placeholder strings.

= 1.4.0 =
* Pasting a pixel (or Microsoft Clarity) snippet now deploys it automatically — no separate "Deploy" checkbox to remember. Previously a pasted-but-unchecked snippet silently never loaded, so the pixel showed as "not active". Untick the box on a later save to pause it.
* Clearer connection state: once you're connected, the Settings card shows a green "Connected to TopSlot" with your brand id instead of a "Reconnect" button. Switching brands is a quiet secondary link.

= 1.3.0 =
* Connect with TopSlot in one click: sign in, pick your brand, and the Brand ID and API key fill in automatically. No copying required. Manual entry is still available.

= 1.2.0 =
* Fixed a fatal error on activation in the Dashboard screen.
* New AI Readiness Audit: live on-site checks (search visibility, AI bot access in robots.txt, sitemap, llms.txt) plus per-page meta and content-length checks.
* Generate and serve /llms.txt built from your published pages.
* Deploy Microsoft Clarity by pasting your snippet or project id (only the validated id is stored; a clean tag is re-emitted).

= 1.1.0 =
* One unified "TopSlot AI Visibility" menu (Dashboard, Content, Settings) replacing the split Settings/Tools screens.
* New Dashboard home screen with connection + status at a glance.
* Deploy your TopSlot attribution pixel by pasting the snippet (only the pixel id is stored; a clean script tag is re-emitted).
* Content screen now shows an overview of your published pages and their current meta.
* Setup prompt guides you to Settings until a brand is connected.

= 1.0.0 =
* Initial release: server-side on-page fixes, SEO-plugin-aware meta, and reviewed content deployment.
