=== Conversational AI Ads & Lead Banner – Legate Ads ===
Contributors: agentictech, legateads
Tags: ai ads, conversational ads, ad manager, chat banner, lead generation
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 8.0
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Embed ringfenced, compliant conversational AI display ads (300x250, 728x90) and capture leads directly inside standard banner slots.

== Description ==

Conversational AI Ads & Lead Banner – Legate Ads lets WordPress site owners, agencies and publishers deploy interactive, AI-driven conversational ads inside standard IAB banner slots — and capture the resulting leads in their own WordPress database.

= Ad Units =

* IAB standard sizes: 300x250, 728x90, 160x600 and 320x50
* Gutenberg block with visual size preview and agent picker
* Classic shortcode: `[legate_ad id="AGENT_ID" size="300x250" theme="light"]`
* Light and dark themes

= Ringfenced & Compliant by Design =

* Every ad unit renders inside a strict sandboxed iframe (`sandbox="allow-scripts allow-forms allow-same-origin"`) — ad code can never touch your page, your cookies or your visitors' sessions outside the frame.
* Deferred execution: the initial script is tiny; the conversational interface only activates on visitor hover, focus or click.
* Native lazy loading of ad iframes.

= Lead Capture You Own =

* Leads captured inside the ad are delivered to your own site via a postMessage bridge and stored locally in a dedicated database table (encrypted at rest).
* Admin leads list with one-click CSV export.
* Rate limiting and honeypot spam protection on the capture endpoint.

= Knowledge Sync (OKF) =

* One-click trigger lets the Legate OKF engine index your public content so ad agents answer with site-specific knowledge.

== External Services ==

This plugin connects to the Legate Ads service (operated by Agentic Tech LLC) to provide conversational AI ad rendering. This connection is required for the plugin's core functionality: ad units are loaded from Legate Ads servers and an API key from a Legate Ads account is required.

What is transmitted and when:

* Account connect (optional): only when you click "Create free account & connect" in the settings, the email address and site URL shown in the connect form are sent to `https://serve.legateads.com/v1/connect/register` to create your account and automatically store an API key.
* Ad rendering: when a page containing an ad unit is viewed by a visitor, the visitor's browser loads an iframe from `https://serve.legateads.com` with the agent ID, ad size, theme and your site's home URL as query parameters. No visitor personal data is sent by the plugin itself.
* API verification: when you click "Verify API Key" in the settings, your API key is sent to `https://serve.legateads.com/v1/auth/verify` over HTTPS.
* Knowledge sync: only when you explicitly click the sync button, your site's public URL is sent to `https://serve.legateads.com/v1/okf/scrape` so the service can index your public content.

Links: [Legate Ads website](https://legateads.com), [Terms of Service](https://legateads.com/terms/), [Privacy Policy](https://legateads.com/privacy/).

Captured leads (name, email, phone, chat summary) are stored in your local WordPress database and are never transmitted to Legate Ads by this plugin.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install via Plugins → Add New.
2. Activate the plugin.
3. Go to Legate Ads → Settings, paste your Legate Ads API key and click "Verify API Key".
4. Add the "Legate Conversational Ad" block to any post or page, or use the `[legate_ad]` shortcode.

== Frequently Asked Questions ==

= Do I need a Legate Ads account? =

Yes. Ad units are rendered by the Legate Ads service, so you need an API key from [legateads.com](https://legateads.com).

= Does the plugin slow down my site? =

No. Ad iframes load lazily and the conversational interface only activates when a visitor interacts with the unit.

= Where are leads stored? =

In a dedicated table in your own WordPress database, encrypted at rest. You can export them as CSV from Legate Ads → Leads.

= Which ad sizes are supported? =

300x250, 728x90, 160x600 and 320x50 (IAB standard units).

== Privacy ==

The plugin stores captured lead data (as submitted by visitors inside the ad unit) in your local database, together with the visitor's IP address and source URL for anti-spam purposes. Configure retention and consent wording according to your jurisdiction. The ad iframe is served by Legate Ads; see their privacy policy at https://legateads.com/privacy/.

== Changelog ==

= 1.0.0 =
* Initial release: Gutenberg block, shortcode engine, sandboxed iframe rendering, local lead storage with CSV export, OKF knowledge sync trigger.
