=== WP Real-Time Analytics ===
Contributors:       yourname
Tags:               analytics, real-time, visitors, traffic sources, page views
Requires at least:  5.8
Tested up to:       6.7
Requires PHP:       7.4
Stable tag:         2.0.0
License:            GPLv2 or later
License URI:        https://www.gnu.org/licenses/gpl-2.0.html

Live visitors, traffic sources, dwell time, and historical page views — stored entirely in your own database. No third-party account needed.

== Description ==

WP Real-Time Analytics gives you two views in your WordPress admin:

**Live** — who is on your site right now: active visitors with page, location and dwell time, device breakdown, top countries, traffic-source split (direct / search / social / referral / internal), and top pages being viewed. Refreshes every 10 seconds.

**History** — page views and sessions over the last 7 / 30 / 90 / 365 days, a page-views trend line, average dwell time per session, a source split, and a top-pages table. Built from a compact daily-aggregate table, so history is kept indefinitely with a tiny storage footprint.

= What's new in 2.0.0 =

* Traffic-source classification (direct, search, social, referral, internal).
* Dwell / session time per visitor and averaged.
* Historical page views with a daily rollup table kept indefinitely.
* Geo-IP moved to a background job — visitor requests no longer wait on an external API.
* Trusted-proxy IP resolution (forwarded headers are only trusted from configured proxies) to stop location spoofing.
* Per-IP rate limiting on the public tracking endpoint.
* Self-hosted dashboard icons (no external CDN request).
* Raw data kept 7 days; older rows are rolled into the daily aggregate before deletion.

= Privacy & security =

* IPs are stored only while geo-lookup is pending, then cleared; a salted hash is retained.
* Geo-IP can be disabled with the `wpra_geo_enabled` filter or the `wpra_geo_enabled` option.
* Configure trusted proxies (e.g. Cloudflare) with the `WPRA_TRUSTED_PROXIES` constant or `wpra_trusted_proxies` filter.

= Compatibility =

* WordPress 5.8+, PHP 7.4 to 8.4
* WooCommerce, Yoast SEO, RankMath
* WP Rocket, W3 Total Cache, LiteSpeed Cache, WP Super Cache
* Cloudflare and reverse-proxy setups
* WordPress Multisite

== Installation ==

1. Upload the plugin folder to /wp-content/plugins/
2. Activate through the Plugins menu
3. Open **Analytics Live** in the admin sidebar
4. (Behind Cloudflare/proxy?) In wp-config.php add:
   `define( 'WPRA_TRUSTED_PROXIES', '173.245.48.0/20,103.21.244.0/22' );`

== Changelog ==

= 2.0.0 =
* Added traffic sources, dwell time, and historical page views.
* Background geo resolution; trusted-proxy IP handling; rate limiting.
* Self-hosted icons; 7-day raw retention with daily aggregation.

= 1.0.0 =
* Initial release
