=== Punchline Analytics ===
Contributors: punchlineanalytics
Tags: analytics, ai agents, bots, privacy, woocommerce
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 0.2.0
License: MIT
License URI: https://opensource.org/licenses/MIT

See which visitors are AI agents. Counts every page request on the server, including agents that never run JavaScript, and WooCommerce orders by people and by agents.

== Description ==

Punchline Analytics shows how much of a site's traffic is AI agents, which ones, what they read, and what they built for the people they work for.

This plugin counts page requests on the server, after WordPress has decided what to serve and before anything is sent, and reports each one to your Punchline collector without waiting for a reply. It also adds the browser snippet, which counts people on pages served from a cache and confirms which visits ran in a real browser. No cookies are set.

With WooCommerce, it also counts each paid order once as a purchase: the total, the currency and the number of items, with the address and browser WooCommerce recorded at checkout so Punchline can find the visit it came from and whether a person or an agent placed it. Never names, emails, addresses or products.

What's sent per page request: the host, the path, `utm_*` values, the query string with credential and personal-data values redacted and emails removed, the referrer's host, the `Accept` header, which browser headers were present (never their values), Web Bot Auth signature headers when an agent sent them, and the IP address and user agent. The collector uses the address and user agent in memory for people, never storing them, and keeps them with the visit for agents. See https://punchlineanalytics.com/docs/privacy.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/`, or install the zip from Plugins → Add New → Upload.
2. Activate it.
3. Settings → Punchline Analytics: paste the DSN from your Punchline dashboard (Site settings → Install).
4. Visit a few pages. They appear in your dashboard within a minute.

== Frequently Asked Questions ==

= My site uses a page cache. What's counted? =

Cached pages are served without running WordPress, so this plugin doesn't see those requests. People on them are still counted by the browser snippet; agents that fetch a cached page are not. For every request including those, put the Cloudflare Worker in front of the site (https://punchlineanalytics.com/docs/install-cloudflare).

= Does it slow pages down? =

No. The event is sent without waiting for a reply, and building it takes well under a millisecond.

= Does it count WooCommerce orders? =

Yes, once per paid order, with the total, currency and item count. Turn it off under Settings → Punchline Analytics. No API key is needed.

= What if Punchline is unreachable? =

Nothing changes for visitors. The request is dropped and the page is served as usual.

== Changelog ==

= 0.2.0 =
WooCommerce purchases: each paid order is counted once, tied to the visit it came from, so orders placed by agents and by people report separately. Declares compatibility with WooCommerce's order storage (HPOS).

= 0.1.0 =
First release: server-side page request events, the browser snippet, Web Bot Auth signatures passed through, Cloudflare and X-Forwarded-For address handling.
