=== Reveata Analytics ===
Contributors: reveata
Tags: analytics, revenue, woocommerce, privacy, statistics
Requires at least: 6.2
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 0.4.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Privacy-friendly web analytics that shows which traffic turns into revenue. Tracking script, WooCommerce revenue and a dashboard widget.

== Description ==

Reveata is web analytics built around revenue: see visitors, pages, sources, goals and the payments each channel brings in. This plugin connects your WordPress site to your Reveata account.

* **Adds the tracking script** to every page, with no code. Single-page navigation, outbound links, scroll depth and goals are tracked by the script.
* **Cookieless mode**: one switch to store nothing in visitors' browsers.
* **WooCommerce revenue**: paid orders and refunds are sent to Reveata in the background and linked to the visit that brought the customer, so revenue shows up per channel, campaign and page. Works with the classic and block checkout, guest orders, WooCommerce Subscriptions renewals, and High-Performance Order Storage. On the order received page the buyer is identified by email, so orders also match their visit when no cookie was set. Connect the store in Reveata (Settings → Payments → WooCommerce) as well for subscriptions, MRR and past orders; orders are never counted twice.
* **Crawler and AI agent requests**: most crawlers (GPTBot, ClaudeBot, Googlebot, link previews) never run JavaScript. Paste your website's bot request token (Reveata → Settings → General → Bot traffic) and the plugin forwards their requests, so they show up on the Bots page.
* **Dashboard widget**: visitors, pageviews, revenue and bounce rate for the last 7 days (compared with the 7 days before) and visitors online now, right in wp-admin.
* **Administrators are not counted** by default.

You need a Reveata account. In Reveata, open your website's Settings → Developer, create a website API key, and paste it into Settings → Reveata.

= Goals =

Track any click as a goal by adding an attribute, for example `<button data-reveata-goal="signup">`, or call `reveata('goal', 'signup')` from your own scripts.

= Developers =

* `reveata_should_track` (filter, bool): skip tracking for a request.
* `reveata_script_attributes` (filter, array): add script attributes such as `data-domains` or `data-exclude-paths`.
* `reveata_bot_hit` (filter, array|null): change or skip (return null) a crawler request before it is forwarded.
* `reveata_widget_capability` (filter, string): who sees the dashboard widget (default `manage_options`).

== External services ==

This plugin connects to Reveata, the analytics service you configure in Settings → Reveata (the "Reveata address"). Nothing is sent before you connect a website.

* **Tracking script.** Every front-end page loads `/js/script.js` (or `/js/script.cookieless.js`) from your Reveata address. In visitors' browsers the script sends the page address, referrer, screen size, language and timezone to Reveata. Visitor IP addresses are used by Reveata to derive the country and city and are not stored. Without cookieless mode the script stores a random visitor id and session id in first-party cookies (`_dt_v`, `_dt_s`).
* **Connecting and the dashboard widget.** When you connect, and when an administrator opens the dashboard, the plugin requests your website's details and statistics from the Reveata API with your website API key.
* **Crawler requests.** Only when you save a bot request token: for front-end requests whose User-Agent looks like a crawler or bot, the plugin sends the requested path (without the query string), host name, User-Agent and HTTP status code to the Reveata API after the page was generated. Requests from ordinary browsers and IP addresses are never sent.
* **WooCommerce orders and refunds.** When an order is paid or refunded, the plugin sends its id, amount (excluding tax), currency, date, customer email, customer name, WordPress customer id and the visitor id captured at checkout to the Reveata API, so the revenue can be attributed. On the order received page the tracking script sends the buyer's billing email, name and customer id (or, for guests, the email) to Reveata to link the order to the visit. You can turn this off in Settings → Reveata.

Reveata terms of service: https://reveata.com/legal/terms
Reveata privacy policy: https://reveata.com/legal/privacy

== Installation ==

1. Install and activate the plugin.
2. In Reveata, open your website's Settings → Developer and create a website API key.
3. In WordPress, open Settings → Reveata, enter your Reveata address and the key, and select Connect.
4. Visit your site in a private window, then check your Reveata dashboard.

== Frequently Asked Questions ==

= Do I need a Reveata account? =

Yes. The plugin sends data to your Reveata website; it does not store analytics in WordPress.

= Is it GDPR friendly? =

Reveata does not store IP addresses. With cookieless mode on, nothing is stored in visitors' browsers and returning visitors are only recognised within a day. Whether you need consent depends on your setup and jurisdiction.

= Are my visits counted? =

Logged-in administrators are not tracked unless you turn that option off.

= Why are some WooCommerce orders not linked to a visit? =

The visit is found through the tracker's cookie at checkout, or by the buyer's email from the order received page. Orders from browsers that block the script, or created by hand in wp-admin, are still recorded as revenue but without a source.

= I connected my store in Reveata too. Are orders counted twice? =

No. Reveata imports the store's orders itself and replaces the copies the plugin sent; the plugin keeps saving the visitor ids that link each order to its visit.

== Screenshots ==

1. Settings → Reveata: connect a website with an API key.
2. Tracking options: cookieless mode, administrators, WooCommerce revenue.
3. The dashboard widget with the last 7 days.

== Changelog ==

= 0.4.0 =
* Store events: WooCommerce add to cart and checkout started are sent as goals with product, quantity and value (Settings → Reveata → Store events).
* The order received page also records the payment for the buyer's visit.

= 0.3.0 =
* Forward crawler and AI agent requests to Reveata with your website's bot request token (Settings → Reveata → Crawler requests).

= 0.2.0 =
* Block checkout: the visitor ids are also saved when the Store API updates the order.
* The buyer is identified by email on the order received page (orders match without a cookie).
* Payments carry the customer's user id; works alongside the Reveata WooCommerce connection without double counting.

= 0.1.0 =
* First release: tracking script, cookieless mode, WooCommerce orders and refunds, dashboard widget.
