=== Cloudflare Analytics ===
Contributors: akensai
Tags: cloudflare, analytics, statistics, performance, cdn
Requires at least: 5.0
Tested up to: 6.4
Stable tag: 2.0.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Complete Cloudflare analytics dashboard with hourly metrics, top URLs, geographic data, and browser statistics.

== Description ==

Cloudflare Analytics brings comprehensive analytics from your Cloudflare account directly into your WordPress dashboard. Track requests, visitors, bandwidth, cache performance, top content, geographic distribution, and browser statistics.

= Features =

* **Real-time Metrics**: Hourly sync of requests, visitors, page views, bandwidth, cache stats, and threats
* **Top Content Analysis**: Track your most-visited URLs with request, visit, and bandwidth data
* **Geographic Insights**: See where your traffic comes from by country
* **Technology Breakdown**: Understand browser usage across your visitors
* **Dashboard Widget**: Quick 7-day overview with trend indicators
* **Historical Data**: Backfill up to 30 days of historical data on setup
* **Efficient Storage**: Intelligent data retention (7 days hourly, permanent daily aggregates)
* **Beautiful Charts**: Interactive Chart.js visualizations
* **Secure**: API credentials encrypted using WordPress salts

= Requirements =

* Cloudflare account with Global API Key
* WordPress 5.0 or higher
* PHP 7.4 or higher

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/cloudflare-analytics/`
2. Activate the plugin through the 'Plugins' screen
3. Go to CF Analytics → Settings
4. Enter your Cloudflare email and Global API Key
5. Select your zone
6. (Optional) Use the backfill function to import historical data

== Frequently Asked Questions ==

= Where do I find my Cloudflare API Key? =

Log into Cloudflare → My Profile → API Tokens → View Global API Key

= Does this work on all Cloudflare plans? =

Yes! Works on Free, Pro, Business, and Enterprise plans. Note: Some advanced features like URL tracking may have limitations on free plans.

= How much database space does this use? =

Very efficient! ~7 KB for 7 days of hourly data, ~16 KB per year of daily data, ~100 KB for 30 days of URL data. Total after 1 year: ~335 KB.

= Can I import historical data? =

Yes! The backfill function can import up to 30 days of historical data.

== Screenshots ==

1. Overview dashboard with metrics and charts
2. Top content analysis showing most-visited URLs
3. Geographic distribution by country
4. Browser statistics
5. Dashboard widget
6. Settings page with backfill function

== Changelog ==

= 2.0.0 =
* Complete rebuild with comprehensive features
* Added top URLs tracking with drill-down capability
* Added geographic data (countries)
* Added browser statistics
* Added backfill function for historical data
* Added tabbed analytics interface (Overview, Top Content, Geography, Technology)
* Improved database schema with 5 optimized tables
* Better organized cron jobs (hourly, daily, monthly)
* Enhanced security with AES-256 encryption
* Improved UI with modern design and Chart.js integration

= 1.0.0 =
* Initial release
* Basic time-series metrics
* Hourly sync
* Dashboard widget

== Upgrade Notice ==

= 2.0.0 =
Major update with top URLs, geographic data, browser stats, and historical data backfill. Recommended for all users.
