=== iGuRu Stats ===
Contributors: iguru
Tags: statistics, analytics, privacy, cookieless, gdpr
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 2.0.3
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Privacy-friendly, cookie-free site statistics inside your WordPress dashboard. No IP addresses, no cookies, no external services.

== Description ==

iGuRu Stats shows how your site is doing, without sending a single byte about your visitors to anyone. Everything is counted and stored in your own WordPress database, in one small table.

**What you see**

* Views and visits per day, for the last 30 days, in a clear bar chart
* Totals for today, 7 days, 30 days, 90 days, 1 year or 2 years
* Views per visit, and your best day ever
* Most read posts, for the chosen period and overall
* Referrers, grouped sensibly: all Google domains as "Google", feed readers together, X/Twitter links together
* Countries, with flags (when your CDN or server provides the visitor's country, e.g. Cloudflare)
* Authors, ranked by the views of their posts

**Privacy by design**

* No cookies, no local storage, no fingerprinting
* No IP addresses are stored, not even shortened ones
* No external services and no third-party scripts
* Only daily totals are kept: there is no record of individual visitors
* Logged-in editors are not counted, and known bots are ignored

Because no personal data is collected, the plugin does not require a cookie consent banner on its own. As always, mention your analytics in your privacy policy.

**Light and fast**

* One tiny inline script (well under 1 KB) that sends a single beacon per page view, only when the page is actually visible
* No jQuery, no chart library: the dashboard uses plain HTML and CSS
* Compatible with page caches (WP Rocket, FlyingPress, LiteSpeed Cache and others) and with Cloudflare: the counter works on cached pages
* Old data is removed automatically after the period you choose (90 days to 2 years)

**Translations**

Included: Greek. The plugin is fully translatable.

== Installation ==

1. Upload the `iguru-stats` folder to `/wp-content/plugins/`, or install the zip from Plugins > Add New > Upload Plugin.
2. Activate the plugin.
3. Open **Statistics** in the admin menu. Counting starts immediately.

== Frequently Asked Questions ==

= Do I need a cookie banner for this plugin? =

The plugin stores no cookies and no personal data, only daily totals per post, referrer and country. In most cases this needs no consent banner. Laws differ between countries, so describe your analytics in your privacy policy, and ask a lawyer if you are unsure.

= Does it work with page caching? =

Yes. Views are counted by a small script in the page, so they are counted even when the page comes from a cache or a CDN. The script is marked so that WP Rocket, FlyingPress and Cloudflare Rocket Loader do not delay it.

= Where do the countries come from? =

From a header that your CDN or server adds to each request, for example Cloudflare's CF-IPCountry. The plugin does not look up IP addresses. If your setup provides no country header, the Countries card stays empty and everything else works normally. Developers can supply the country with the `iguru_stats_country` filter.

= What is the difference between a view and a visit? =

A view is counted each time a post is opened. A visit is counted for the first page of a visit that comes from outside your site (a search engine, social media, a direct link). Moving between your own pages adds views, not visits.

= Are my own visits counted? =

No. Logged-in users who can edit posts are not counted. Use the `iguru_stats_skip_user` filter to change this.

= How much space does it use? =

Very little: only daily totals are stored. Even a busy site with thousands of posts uses a few megabytes per year. The Data section of the Statistics page shows the current size, and lets you delete a single month.

= What happens when I delete the plugin? =

By default your statistics are kept, so you do not lose them by accident. To remove everything, tick "Delete all statistics when the plugin is deleted" in Statistics > Data before deleting the plugin.

= Can my theme provide the view counts instead of the plugin's script? =

Yes. A theme that already counts views can declare `add_theme_support( 'iguru-stats' )` and call `do_action( 'iguru_stats_record_view', $post_id, $referrer )` for each counted view (`$referrer` is the page's document.referrer for the first view of a page load, and `null` for later ones). The plugin then adds no script.

= Which hooks are available? =

* `iguru_stats_record_view` (action): record a view from a theme or another plugin
* `iguru_stats_own_counter` (filter): turn the built-in counter on or off
* `iguru_stats_skip_user` (filter): decide whether the current user is counted
* `iguru_stats_is_bot` (filter): adjust bot detection
* `iguru_stats_country` (filter): supply the visitor's two-letter country code
* `iguru_stats_referrer_name` (filter): change how a referrer host is grouped
* `iguru_stats_alltime` (filter): supply all-time totals for the "Most read" card

== Screenshots ==

1. Views and visits per day, with the period selector and the summary.
2. Most read posts, referrers, countries and authors.
3. The Data section: retention period, table size and deleting a month.

== Changelog ==

= 2.0.3 =
* Author name updated

= 2.0.2 =
* Translations are loaded by WordPress automatically
* Code annotated for the WordPress coding standards (Plugin Check)

= 2.0.1 =
* All database queries use prepared statements, including table names (%i)
* Output of the statistics cards escaped with a strict allow-list
* Scripts and styles loaded through the WordPress script and style APIs
* Requires WordPress 6.2 or later

= 2.0.0 =
* Works on its own with any theme; theme integration through documented hooks
* Fully translatable, with a Greek translation
* Countries from more CDN and server headers (Cloudflare, CloudFront and others)
* Counter script marked for WP Rocket, FlyingPress and Cloudflare
* Option to delete all statistics when the plugin is deleted
* Own table name (wp_iguru_stats); data of version 1.x is moved automatically

= 1.2.1 =
* Best day ever; data retention setting; delete a single month

== Upgrade Notice ==

= 2.0.0 =
Your existing statistics are moved to the new table automatically on the first admin page load.
