=== DevDome Affiliate Manager ===
Contributors: devdome
Tags: amazon, affiliate, amazon associates, affiliate links, woocommerce
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 0.5.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Manage Amazon affiliate links: auto-tagging, geo-localization, dead-link recovery, link health monitoring, and click protection.

== Description ==

DevDome Affiliate Manager keeps your Amazon affiliate links correctly tagged, healthy, and converting — automatically.

**Link Setup** — Store an affiliate tag per Amazon store (22 marketplaces). Apply a tag sitewide or by post/page/category rules (priority: post/page > category > sitewide). On the front end, Amazon links in your content get the right `?tag=`, plus `rel="nofollow sponsored"` and an optional new tab. A `[devdome_aff_button]` shortcode renders a styled, auto-tagged button from an ASIN or custom URL.

**Click redirect (/go)** — All Amazon clicks route through a `/go` endpoint that expands shortlinks, enforces an Amazon-only allowlist (no open redirect), applies the correct tag, and records the click.

**Keyword Auto-Linker** — Automatically turn chosen keywords in your content into tagged Amazon links, with per-rule limits, match types, and skip rules (headings, code, existing links, etc.).

**Link Radar (Scanner + Monitor)** — Scans your content (and WooCommerce external products) for Amazon ASINs, then checks each for **Live / Out-of-Stock / 404** status on a schedule.

**Smart dead-link recovery** — When a product is out of stock or its page is gone (404), redirect the click to a relevant live product (built from the product title/metadata) or to the Amazon search page — chosen per status. Includes a one-click bulk **Replace ASIN** tool.

**Geo-localization (OneLink alternative)** — Detect a visitor's country and send them to their local Amazon store with your tag for that store, only where you have a tag (commission stays safe). Cross-region ASIN is validated; dead ASINs fall back to the local search page.

**WooCommerce** — Optionally rewrite external/affiliate product buttons to route through `/go` with your tag.

**Click Protection** — Block known bots (synced verified-bot list) from triggering affiliate links, with selectable redirect methods.

**Mobile App Opener** — Optionally open Amazon links in the Amazon app on mobile (Android intent; iOS "Open in Safari" helper inside in-app browsers).

== External services ==

This plugin connects to the DevDome backend at **https://api.devdome.com** so that API keys and shared data stay on the server (never shipped in the plugin). It is used as follows:

* **Click Protection** — downloads a list of known-bot user-agent patterns (`/bot-protection/list`). No personal data is sent; matching happens locally on your site.
* **Link Monitor** — sends product **ASINs** and the Amazon **domain** (`/amazon-404-oos-checker/check-batch`) to classify them as live / out-of-stock / 404.
* **Dead-link recovery** — sends a product **keyword** (`/amazon-404-oos-checker/search`) to find a live replacement product.
* **Geo-localization** — when enabled, sends the **visitor's IP address** and the product **ASIN** (`/geo-resolve/resolve`) to determine the visitor's country and the best local Amazon URL. The IP is used only for the country lookup and cached briefly.

By using these features you agree to DevDome's terms and privacy policy (https://devdome.com). Geo-localization is off by default; enable it only if you want visitor IPs used for country detection.

== Installation ==

1. Upload the plugin ZIP via Plugins → Add New → Upload Plugin, or copy the folder to `wp-content/plugins/`.
2. Activate it.
3. Go to the DevDome Affiliate Manager admin page, add your Amazon affiliate tag(s), and configure the features you want.

== Frequently Asked Questions ==

= Do I need an API key? =
No. The shared services run on the DevDome backend; you don't paste any key.

= Does geo-localization need every regional Amazon tag? =
It only redirects to stores you've added a tag for. Visitors from other countries keep the original link, so you never lose a commission.

= What happens when a product is discontinued? =
The monitor flags it, and (if enabled) clicks are redirected to a live replacement product or the Amazon search page instead of a dead page.

== Changelog ==

= 0.3.1 =
* Button Link: moved the custom-link guidance into an info icon on the "Use Custom Link" option; custom-link example now uses the Amazon-style /dp/{ASIN} path.

= 0.3.0 =
* Button Link: choose the Amazon marketplace for generated links via Edit / Regenerate, with an option to omit the affiliate tag.
* Custom button links now support an {ASIN} placeholder that is filled with the product's ASIN at render time.
* Clearer "Use Generated Link" / "Use Custom Link" labels, plus a hint that non-Amazon custom links are not affiliate-tagged.

= 0.2.0 =
* Per-status dead-link routing (replacement product / search page) for Out-of-Stock and 404.
* Tiered keyword from product metadata or cleaned title.
* readme + license metadata; passes Plugin Check with no errors.

= 0.1.9 =
* Smart dead-link recovery: replacement-product or search-page redirect, per status (OOS / 404).
* Keyword built from product metadata or cleaned title.
* WooCommerce external-button rewrite; bulk Replace ASIN tool.
* Geo-localization, click protection, mobile app opener, link monitor.
