=== DataDuel Affiliate Link Protect ===
Contributors: thedataduel
Tags: affiliate, seo, schema, json-ld, ai
Requires at least: 5.6
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Keep your affiliate links alive in AI answers. Auto-injects the scripts you generate at Northstar into your pages — no manual pasting.

== Description ==

AI answer engines increasingly summarize content and quietly drop affiliate links — costing publishers commissions. **Northstar** generates per-page schema.org JSON-LD and `llms.txt` guidance that tells AI engines to preserve *your* affiliate links and attribute the click to you.

This plugin connects your WordPress site to your Northstar account. Generate your scripts at Northstar (single page or bulk from your sitemap), paste your API key here, and the plugin:

* **Syncs** every generated script from your Northstar account (hourly, plus on-demand),
* **Auto-injects** each page's JSON-LD into the correct page's `<head>` — no copy-paste,
* **Serves a merged `/llms.txt`** assembled from every protected page.

A 50- or 500-page site is protected in a few clicks instead of hundreds of manual pastes.

= What you need =

* A Northstar account at https://thedataduel.com with generated scripts.
* An API key (Dashboard → Plugin / API key → Generate a key).

== Installation ==

1. Upload the plugin to `/wp-content/plugins/` or install it from the Plugins screen.
2. Activate **Northstar Affiliate Protect**.
3. Go to **Settings → Northstar Protect**.
4. Paste your API key, save, then click **Sync now**.
5. Done — your generated scripts now auto-inject into the matching pages.

== Frequently Asked Questions ==

= Where do I get the API key? =
In your Northstar dashboard: **Plugin / API key → Generate a key**. It's shown once — copy it into the plugin.

= How does it match scripts to pages? =
Each generated script is keyed by its source URL. The plugin matches the URL of the page being rendered to the cached script and injects it. Matching is scheme- and trailing-slash tolerant.

= Does it slow down my site? =
No. Scripts are cached locally in your database; injection is a single indexed lookup per page. The only remote call is the periodic background sync.

= Is my API key safe? =
The key is stored in your WordPress options and sent only to your configured Northstar API base over HTTPS. You can revoke it any time from your Northstar dashboard.

= What happens if I delete the plugin? =
Uninstalling removes the local cache table and all plugin options.

== Screenshots ==

1. Settings → Northstar Protect: paste your API key, test the connection, and sync.
2. Status panel showing cached scripts and the last sync time.
3. Your Northstar dashboard, where you generate the API key (Plugin / API key panel).

== Changelog ==

= 1.0.0 =
* Initial release: API-key sync from the Northstar export endpoint, automatic per-page JSON-LD injection, merged /llms.txt endpoint, hourly + on-demand sync.

== Upgrade Notice ==

= 1.0.0 =
First release.
