=== Customer Intelligence for WooCommerce ===
Contributors: businesskhana
Tags: woocommerce, analytics, clv, rfm, churn
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Customer analytics for WooCommerce: lifetime value, RFM segmentation, churn risk, cohort retention, and CSV export. All data stays local.

== Description ==

**Customer Intelligence for WooCommerce** brings enterprise customer analytics directly into your WordPress admin. Predict Customer Lifetime Value, segment customers with RFM analysis, identify churn risk, and analyze cohort retention — all without sending a single byte to a third-party service.

= Why this plugin =

* **100% WordPress-Native** — Your customer data stays on your server. No external APIs, no SaaS subscriptions.
* **Affordable** — Free open-source alternative to Metorik ($50-200/mo) and Glew.io ($79+/mo).
* **Fast and lightweight** — Background processing via WP-Cron, no impact on storefront performance.
* **HPOS Compatible** — Works with WooCommerce High-Performance Order Storage.

= Key Features =

* **Customer Lifetime Value (CLV)** — Predict the revenue every customer will generate using historical purchase data.
* **RFM Segmentation** — Visual 5x5 matrix classifying customers into Champions, Loyal, At Risk, Lost, and more.
* **Churn Prediction** — Heuristic churn-risk scoring with configurable thresholds.
* **Cohort Retention Heatmap** — See how each cohort of new customers retains over time.
* **Segment Export** — CSV export compatible with Mailchimp, Klaviyo, and other email platforms.
* **Weekly Digest Email** — Optional weekly summary of newly at-risk customers.
* **WooCommerce Admin Integration** — CLV and churn risk columns in the Users list, plus a dashboard widget.

= Segments included =

* Champions, Loyal, Potential Loyalists, New Customers, Promising
* Need Attention, About to Sleep, At Risk
* Hibernating, Lost, Cannot Lose Them

= Privacy =

All processing happens on your own server. No customer data is transmitted externally. See PRIVACY.md for details.

== Installation ==

1. Install WooCommerce first (required dependency).
2. Upload the plugin files to `/wp-content/plugins/customer-intelligence-for-woocommerce/`, or install through the WordPress plugin directory.
3. Activate the plugin through the **Plugins** screen in WordPress.
4. Go to **Customer Intel > Dashboard** and click **Recalculate** to run the initial analysis.
5. Configure options under **Customer Intel > Settings**.

== Frequently Asked Questions ==

= How is CLV calculated? =

CLV = Average Order Value x Purchase Frequency x Estimated Customer Lifespan. The plugin uses completed and processing orders to compute these values per customer.

= Does this work with HPOS? =

Yes. The plugin fully supports WooCommerce High-Performance Order Storage (Custom Order Tables) and declares compatibility on activation.

= Will this slow down my store? =

No. All calculations run in the background via WP-Cron in configurable batches (default: 100 customers per run). No queries run on the storefront.

= Can I export segments to my email marketing tool? =

Yes. Any segment can be exported as CSV. Field names are compatible with Mailchimp, Klaviyo, ConvertKit, and most ESPs.

= Does this plugin send my data anywhere? =

No. All processing is local to your WordPress server. There are no external API calls.

= What user role is required? =

Users need the `manage_woocommerce` capability (Shop Manager or Administrator).

== Screenshots ==

1. Main dashboard with KPIs, top customers, and at-risk alerts.
2. Visual 5x5 RFM segmentation matrix.
3. Customer detail page with CLV metrics and order history.
4. Cohort retention heatmap.
5. Segment cards with recommended marketing actions.
6. Churn risk analysis with sortable customer list.

== Changelog ==

= 1.0.0 =
* Initial release.
* CLV calculation engine.
* RFM segmentation with visual 5x5 matrix.
* Churn prediction with heuristic algorithm.
* Cohort retention heatmap.
* Segment management and CSV export (generic + Mailchimp formats).
* Weekly churn digest email.
* WooCommerce admin integration: CLV and churn columns on Users list, dashboard widget.
* HPOS (Custom Order Tables) compatibility.

== Upgrade Notice ==

= 1.0.0 =
Initial release of Customer Intelligence for WooCommerce.
