=== Limy Agent Analytics ===
Contributors: limyai
Donate link: https://limy.ai
Tags: analytics, bot detection, ai agents, traffic
Requires at least: 6.2
Tested up to: 7.1
Stable tag: 1.2.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Lightweight HTTP request logging for advanced bot detection and AI agent traffic insights.

== Description ==

Limy Agent Analytics captures HTTP request metadata from your WordPress site and sends it to Limy's analytics platform for bot detection and traffic analysis.

**What it does:**

* Logs request method, path, status code, user agent, and timing
* Queues logs locally and sends them in compressed batches via cron
* Provides an admin dashboard to configure and monitor the plugin
* Redacts sensitive query parameters automatically

**Key features:**

* Gzip-compressed API delivery — saves 60-80% bandwidth
* Size-aware batch chunking — no oversized payloads
* Jittered retry backoff — prevents thundering-herd failures
* O(1) event capture — zero overhead on every page load
* Lazy service loading — admin code never loads on the frontend

**External Service**

This plugin sends request log data to the Limy analytics API at `https://stream.getlimy.ai`. An API key is required.

* [Limy Terms of Service](https://limy.ai/legal/terms-and-conditions)
* [Limy Privacy Policy](https://limy.ai/legal/privacy-policy)

When tracking is active, the plugin records every front-end request that reaches WordPress and sends the records to the API about once a minute. The "Test Connection" button also sends one test event.

Optional data sources, enabled only by an administrator in Settings > Limy Agent Analytics > Data Sources:

* WP Engine access log: on WP Engine, the plugin reads the origin access log that WP Engine provides to the site (the same log linked from wp-admin under WP Engine > Information), which also records pages served from WP Engine's cache. It is fetched from the site's own `*.wpenginepowered.com` address; the log address is not stored or sent anywhere.

* Web server access log: the plugin reads the access log that your host already writes and sends its entries (including pages served from cache) instead of capturing requests itself. Lines for other hosts, static assets and excluded routes are skipped. To check that a log belongs to this site, the plugin requests your home page once with a `limy_log_probe` parameter.

Data sent per request: HTTP method, host, request path, query parameters (up to 20, with sensitive names such as password, token, key, email or code redacted), response status code, client IP address (and the address of the connecting proxy, if any), user agent, referer URL, request duration, and content length. Referer URLs and query values can contain personal data; exclude routes or add parameter names to the redaction list in the plugin settings if needed.

== Installation ==

1. Upload the `limy-agent-analytics` folder to `/wp-content/plugins/`.
2. Activate the plugin through the Plugins menu.
3. Go to Settings > Limy Agent Analytics and enter your API key.
4. Check the "Activate Tracking" checkbox and save.

== Frequently Asked Questions ==

= Where do I get an API key? =

Sign up at [getlimy.ai](https://limy.ai) to obtain your API key.

= What data is sent? =

Request metadata: method, host, path, query parameters (sensitive names redacted), status code, client IP, user agent, referer, timing, and content length. See "External Service" above for details.

= Does this slow down my site? =

No. Event capture uses a single O(1) database insert on the `shutdown` hook. No external HTTP calls are made during the page load — events are dispatched in the background via WP-Cron.

== Screenshots ==

1. Connection settings — configure your API key and dispatch settings.
2. Monitor section — view queue size, circuit breaker status, and dispatch schedule.

== Changelog ==

= 1.2.0 =
* New: Data Sources panel shows the CDN and page cache in front of WordPress.
* New: on WP Engine, ship WP Engine's access log, so pages served from WP Engine's cache are counted.
* New: ship the web server's access log instead of in-PHP capture, so pages served from cache are counted. The plugin finds and verifies the log, follows rotation, and falls back to plugin capture if the log becomes unreadable.

= 1.1.0 =
* Fix: a failed or partial batch no longer deletes events that were never sent.
* Fix: rate-limit (429), timeout (408) and payload-size (413) responses are retried instead of dropped.
* Fix: an ingestion outage no longer discards queued events; events expire only after 14 days.
* Fix: retry timing is correct when the database is not on UTC.
* Fix: dispatch keeps sending batches until the queue is empty (up to 20 seconds per run).
* Fix: concurrent dispatch runs can no longer send the same events twice.
* Fix: non-ASCII URLs are recorded correctly.
* New: events include the connecting address (`peer_ip`) next to the forwarded client IP.
* Fix: very large requests can no longer exhaust memory during dispatch.
* Fix: event time and duration are measured from the start of the request.
* Removed Google Fonts; the admin page uses the system font.
* Wider default list of redacted query parameters.

= 1.0.2 =
* Fix: request path now keeps the site base path (e.g. `/blog`) when WordPress is served from a subdirectory behind a proxy that strips it.

= 1.0.1 =
* Gzip compression, O(1) event capture, jittered retry backoff, and redesigned admin UI.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.2.0 =
Adds an access-log data source that also counts pages served from cache.

= 1.1.0 =
Fixes several cases where queued events could be lost or sent twice. Recommended for all users.

= 1.0.2 =
Fixes missing subdirectory prefix in recorded request paths.

= 1.0.1 =
Performance improvements: gzip compression, O(1) event capture, jittered retry backoff, and redesigned admin UI.

= 1.0.0 =
Initial release.
