=== PureDevs Customer History for WooCommerce ===
Contributors: puredevs, ympervej86
Tags: customer history, woocommerce customer analytics, customer search tracking, woocommerce customer insights, woocommerce reports
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 3.0.2
Requires Plugins: woocommerce
WC requires at least: 7.0
WC tested up to: 10.7
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

WooCommerce tells you what your store did. Customer History tells you who your customers are — and what they're doing.

== Description ==

<p><strong>Customer History 3.0.0 is a complete revamp</strong> — rebuilt from the ground up as a focused customer-intelligence and reporting tool for WooCommerce. We've moved away from scattered actions and doubled down on one thing: showing you exactly what your customers are doing on your store — who's buying, who's browsing without buying, and what they're searching for — so you can plan your next move with real insight instead of guesswork. The analytics are read-only and run entirely on your own server, and the plugin never contacts your customers automatically — it sends no bulk or marketing emails.</p>

<p>Most WooCommerce stores fly blind on their customers. The native dashboard reports orders, revenue, and traffic — but not <em>who</em> is buying, who's browsing without buying, what people are searching for, or which searches return nothing. PureDevs Customer History turns raw store activity into <strong>customer intelligence</strong>: profiles, search insight, view tracking, and segments — all inside wp-admin.</p>

<p>Tracking starts the moment you activate it: no wizard, no configuration, works out of the box. And it's private by design — all data stays in your own WordPress database, with nothing sent to any third-party service or API.</p>

<h4>SEE IT IN ACTION</h4>

<p>Watch a full walkthrough of the dashboard, customer profiles, and search analytics — and how to use them to identify your most valuable customers:</p>

https://www.youtube.com/watch?v=anFJa63GnfI

<h4>TRY THE LIVE DEMO</h4>

<p>Explore the full plugin — including all Pro intelligence features — on our live demo store. No installation needed:</p>

<ul>
<li>Demo: <a href="https://ch.puredevs.com/wp-admin">https://ch.puredevs.com/wp-admin</a></li>
<li>Username: <code>demo</code> &nbsp;|&nbsp; Password: <code>demo1234</code></li>
</ul>

<p>The demo account is read-only — you can browse every screen, but nothing can be added or changed.</p>

<h4>WHAT CUSTOMER HISTORY SHOWS YOU</h4>

<p><strong>Customer Intelligence Dashboard.</strong> Your store's customer nerve centre. See total customers, new customers this period, and active customers at a glance, plus widgets for top customers by lifetime value, latest orders with customer context, top-selling products, top search terms, top categories, recent searches, and most-viewed products — with a date-range picker and period-over-period comparison.</p>

<p><strong>Customer List &amp; Profiles.</strong> A customer-first view of your store. Sort and search your customers by name, email, orders, lifetime spend, and last order date. Open any customer to see their full profile: financial summary, complete order history, that customer's recent searches, and recently viewed products — data WooCommerce native simply does not provide.</p>

<p><strong>Search &amp; Discovery Analytics.</strong> A dedicated Search Analytics page with nothing comparable in WooCommerce. See your top search terms and most recent searches — so you know exactly what shoppers are looking for — alongside the most-viewed products with view counts and your top viewed categories.</p>

<p><strong>View Tracking.</strong> Passive, lightweight tracking of which products and categories your customers view. The view-to-purchase gap is invisible to WooCommerce native; Customer History surfaces it on every customer profile and on the Search Analytics page.</p>

<p><strong>Revenue.</strong> A focused revenue dashboard: net revenue, orders, average order value, and customers for the selected period (within the free 90-day window) with period-over-period comparison and a revenue trend chart.</p>

<p><strong>Order History.</strong> A store-wide order list you can filter by date range, order status, and keyword, with quick links straight into the matching WooCommerce order edit screens — a fast way to find and cross-reference orders alongside everything else you know about the customer.</p>

<p><strong>Manual Customer Email.</strong> When you want to follow up with a single customer, you can compose and send them a one-off email straight from their profile. It's entirely manual and admin-initiated — there are no automated sends, no bulk emails, and no marketing campaigns. You write each message yourself, and the plugin never contacts a customer unless you choose to.</p>

<p><strong>Customer Segments.</strong> Save a customer segment configuration for quick recall. The Segments page shows your saved segment with a live customer count and one-click CSV export.</p>

<p><strong>Weekly Email Digest.</strong> An optional, opt-in weekly summary email sent to you, the store owner: new customers, top search terms, top customers, and most-viewed products. Keeps you informed about customer activity even when you don't log in. (Admin-only — the digest goes to you, the store owner, not to your customers.)</p>

<p><strong>CSV Export.</strong> Export your customer list to CSV at any time.</p>

<h4>FREE VERSION SCOPE</h4>

<p>The free version shows up to <strong>100 customers</strong> in the customer list and the most recent <strong>90 days</strong> of analytics. All data — for every customer and every session — is collected from day one. The free version simply shows the most recent 100 customers and 90-day window; the full view is available in Pro.</p>

<h4>PRIVATE BY DESIGN</h4>

<p>Customer History is built around observation and reporting. It runs no automation, sends no bulk or marketing emails, creates no coupons, and never modifies orders, product data, or any WooCommerce setting. The one outbound action it offers is fully optional and manual: you can send an individual customer a one-off email that you compose yourself from their profile — nothing is ever sent automatically. It's HPOS-compatible, supports the WordPress GDPR export/erase workflow, and keeps all data on your own server.</p>

== Upgrade to Pro ==

<p>Customer History Pro extends the free plugin with advanced customer intelligence. Upgrading doesn't add a second plugin — the advanced features simply switch on, with all your previously captured data intact. Pro unlocks:</p>

<ul>
<li><strong>RFM Segments</strong> — instantly see whether a customer is a Champion, Loyal, At Risk, or Lost, based on Recency, Frequency, and Monetary scoring.</li>
<li><strong>Customer Health Score</strong> — a 0–100 score blending recency, frequency, spending, and engagement, with trend tracking.</li>
<li><strong>Churn Risk &amp; Prediction</strong> — identify customers who are about to stop buying, with at-risk alerts.</li>
<li><strong>Behavioral Tags</strong> — automatic badges such as Bargain Hunter, Cart Abandoner, and Brand Loyal.</li>
<li><strong>Lifecycle Stages</strong> — see where each customer sits in their journey: New, Active, Loyal, or Lapsed.</li>
<li><strong>Full Session History</strong> — every visit, page view, and search a customer has made, beyond the free 90-day window.</li>
<li><strong>Abandoned Cart Tracking</strong> — observe carts and detect abandonment and recovery, with an admin list and dashboard widget. (Tracking and insight only — no recovery emails are sent.)</li>
<li><strong>Full Revenue Analytics</strong> — a complete revenue dashboard with KPI cards, time-series, and a new-vs-returning-vs-guest revenue split.</li>
<li><strong>Enhanced Product Reports</strong> — product revenue over time, frequently-bought-together correlations, and a revenue-pattern heatmap by day and hour.</li>
<li><strong>Aggregate Conversion Funnel</strong> — a store-wide funnel view from sessions to purchase.</li>
<li><strong>Revenue Data Integrity</strong> — a diagnostic that validates the accuracy of your revenue figures.</li>
<li><strong>Stats pages</strong> — product-view stats, search-keyword stats, taxonomy/category stats, top-selling products, total customer spend, and live sessions.</li>
<li><strong>Advanced customer table</strong> — extra columns (RFM segment, health score, lifecycle stage, behavioral tags) and filters by country, RFM segment, health score, health trend, lifecycle stage, and behavior.</li>
<li><strong>Advanced order-history filters</strong> — filter orders by payment method and order total.</li>
<li><strong>Session data tools</strong> — export and import session data (CSV), delete data by date range, and exclude bot/admin sessions from tracking.</li>
<li><strong>Ready-made segments</strong> — pre-built Pro segments out of the box (High Value At Risk, Loyal Champions, Needs Attention, Hibernating, High Health Declining).</li>
<li><strong>No limits</strong> — unlimited customers, full historical data, and unlimited saved segments.</li>
</ul>

<p><strong>See Pro in action first:</strong> log in to the <a href="https://ch.puredevs.com/wp-admin">live demo</a> (username <code>demo</code>, password <code>demo1234</code>) and browse every Pro screen — RFM segments, health scores, abandoned carts, revenue analytics — before you buy.</p>

<p>Learn more at <a href="https://puredevs.com/pricing">https://puredevs.com/pricing</a>.</p>

== Installation ==

Manual installation takes less than a minute.

1. Download the plugin from wordpress.org, unpack it, and upload the <strong>[PureDevs Customer History for WooCommerce]</strong> folder to your <strong>wp-content/plugins/</strong> directory — or install it directly from the Plugins screen in WordPress.
2. Activate the plugin through the Plugins menu in WordPress.
3. Go to <strong>Customer History &gt; Settings</strong> to configure tracking options (optional — defaults work out of the box).

Data collection begins the moment the plugin activates. No setup wizard or configuration is required. You are good to go.

== Frequently Asked Questions ==

<strong>Q. Is this plugin only for WordPress sites?</strong><br>
A. Yes. The plugin works with WordPress sites that have WooCommerce installed and activated. WooCommerce is required.

<strong>Q. Where is my customer data stored?</strong><br>
A. All data is stored in your own WordPress database. The plugin never sends customer data to any external service, API, or third-party server. Your data stays on your own server.

<strong>Q. Is there a video walkthrough?</strong><br>
A. Yes. You can watch a full walkthrough of the dashboard, customer profiles, and search analytics here: https://www.youtube.com/watch?v=anFJa63GnfI

<strong>Q. Is there a live demo I can try?</strong><br>
A. Yes. Log in to https://ch.puredevs.com/wp-admin with username <code>demo</code> and password <code>demo1234</code>. The demo runs the Pro version, so you can explore every feature. The account is view-only — you can browse all screens but cannot add or edit anything.

<strong>Q. Is the plugin compatible with WooCommerce High-Performance Order Storage (HPOS)?</strong><br>
A. Yes. The plugin uses WooCommerce CRUD methods and declares HPOS compatibility. It does not query the posts table directly for orders.

<strong>Q. Will this plugin slow down my store?</strong><br>
A. No. Session and view tracking writes are lightweight and happen passively during normal page loads. Heavy analytics queries run on demand and cache their results. You can configure the plugin to exclude bot and admin sessions to further reduce data volume.

<strong>Q. What customer data is stored, and how do I erase it for GDPR?</strong><br>
A. The plugin stores session data in your WordPress database: page views, search queries, and product views associated with each customer. No data leaves your server. To export or erase a customer's data, use the built-in WordPress tools at Tools &gt; Export Personal Data and Tools &gt; Erase Personal Data — the plugin fully supports the WordPress privacy request workflow.

<strong>Q. Does the plugin send emails to my customers?</strong><br>
A. The plugin never sends automated, bulk, or marketing emails to your customers, and it runs no campaigns. The weekly digest is an admin-only email delivered to you, the store owner. It does include one optional manual tool: from a customer's profile you can compose and send a single one-off email to that one customer yourself. Nothing is ever sent automatically — a customer is only ever emailed if you write and send the message.

<strong>Q. Does the plugin modify orders, products, or WooCommerce settings?</strong><br>
A. No. The plugin is observational where your store data is concerned. It never modifies orders, creates coupons, changes product data, or alters any WooCommerce setting.

<strong>Q. Is the plugin affected by the reported Freemius SDK vulnerabilities?</strong><br>
A. No. The plugin bundles Freemius WordPress SDK version 2.13.4. The two publicly reported Freemius SDK vulnerabilities were fixed in SDK versions 1.0.1 and 1.0.2, long before the version shipped here, so this plugin is not affected.

<strong>Q. What does the free version include?</strong><br>
A. The free version shows up to 100 customers in the customer list and the most recent 90 days of analytics, with the full Customer Intelligence Dashboard, customer profiles, Search Analytics, view tracking, a Revenue dashboard, an Order History page with date/status/keyword filters, one saved segment, the weekly digest, a manual one-to-one customer email tool, and CSV export. All data is captured from day one; upgrading to Pro unlocks the full customer list, full history, and the advanced intelligence features.

<strong>Q. Do I need any technical knowledge to use the plugin?</strong><br>
A. No. Just install and activate — no coding required. All data is collected automatically from your WooCommerce store.

== Screenshots ==

1. Customer Intelligence Dashboard — overview cards and widgets showing customer activity at a glance.
2. Customers list — sort, search, and the free-tier scope banner.
3. Customer profile — financial summary, order history, recent searches, and viewed products.
4. Search Analytics — top searches, recent searches, most-viewed products, and top categories.
5. Segments page — a saved segment with live customer count and CSV export.

== Source Code for Bundled Libraries ==

This plugin bundles the following third-party JavaScript libraries:

* **Date Range Picker** (admin/js/daterangepicker.min.js)
  * Unminified source: admin/js/daterangepicker.js (included in the plugin package)
  * Original source: https://github.com/dangrossman/daterangepicker
  * Version: 3.1.0
  * License: MIT License
  * Copyright (c) 2012-2019 Dan Grossman

* **Chart.js** (admin/js/chart.umd.js)
  * Original source: https://github.com/chartjs/Chart.js
  * Version: 4.4.1
  * License: MIT License
  * Copyright (c) 2014-2023 Chart.js Contributors

== Changelog ==

= 3.0.2 =
- REMOVED: the churn screen's "Create Coupon" action and the automated win-back email. The plugin now creates no WooCommerce coupons and sends no marketing email to customers, matching its observe-and-report design. The manual, admin-composed one-to-one customer email tool is unchanged and still available from a customer's profile.
- IMPROVED: the churn card on a customer profile now shows a predicted next-order date alongside the existing "days overdue" figure. It is derived from data already collected, so it needs no new tracking.
- FIXED: the RFM component of the churn prediction model never matched a customer's stored RFM segment, so it always contributed a flat neutral score. Segment and recency/frequency/monetary lookups now read the correct stored values. This component is not yet wired into the scores shown on screen, so existing churn scores are unchanged and no recalculation is needed.
- FIXED: Pro feature descriptions listed behavioral badges the plugin does not produce, and overstated the customer-table filters. Both now match the actual features.
- REMOVED: unused legacy referral and points code left behind by the 2.1.8 feature removal, plus a group of unreachable helper methods in the customer-list class. No change in behaviour.
- IMPROVED: uninstall now also clears legacy referral settings left by 2.x installs.
- COMPATIBILITY: tested against WooCommerce 10.7. Added a FAQ entry confirming the bundled Freemius SDK (2.13.4) is not affected by the reported Freemius SDK vulnerabilities, which were fixed in SDK 1.0.1/1.0.2.
- Also includes the 3.0.1 changes, which shipped without a changelog entry: hardened guest, bot, and registered-user handling in the sessions list, and live demo details added to the plugin listing.

= 3.0.0 =
- NEW: Customer Intelligence Dashboard — overview cards (total, new, and active customers) plus widgets for top customers by lifetime value, latest orders, top-selling products, top searches, top categories, recent searches, and most-viewed products, with a date-range picker and period-over-period comparison.
- NEW: Search &amp; Discovery Analytics page — top search terms, recent searches, most-viewed products with view counts, and top viewed categories.
- NEW: Per-customer profile page — financial summary, complete order history, that customer's recent searches, and recently viewed products.
- NEW: View tracking — passive tracking of which products and categories customers view.
- NEW: Revenue dashboard — net revenue, orders, AOV, and customers with period-over-period comparison and a revenue trend chart (free 90-day window).
- NEW: Order History page — a store-wide order list filterable by date range, status, and keyword, with quick links into the matching WooCommerce order edit screens.
- NEW: Customer Segments — save a segment with a live member count and one-click CSV export.
- NEW: Weekly email digest (opt-in, admin-only) summarising new customers, top searches, top customers, and most-viewed products.
- NEW: Manual one-to-one customer email tool — compose and send a single, admin-initiated email to an individual customer from their profile. No automated sends, no bulk emails, no marketing campaigns.
- NEW: Free-tier scope — customer list shows the most recent 100 customers and a 90-day analytics window, with clear scope banners.
- IMPROVED: Reworked as a focused customer-intelligence and reporting plugin. The analytics are observation-and-reporting focused; the only outbound action is a manual, one-to-one customer email you send yourself.
- COMPATIBILITY: WordPress 6.0+, WooCommerce, HPOS-compatible. Compatibility check with the latest WordPress and WooCommerce versions.

= 2.1.8 =
- All features are now free with no premium gating.
- Removed session and behaviour tracking features (page visit recording, URL session logging, live search term tracking).
- Removed statistics section (product view vs. purchase ratio, most-viewed products/categories reports).
- Removed customer point system and Bronze/Silver/Gold/Platinum categorisation.
- Removed coupon generation for customer categories.
- Removed conversion funnel visualisation.
- Removed customer referral system.
- Weekly reports simplified to Orders and Top Customers reports.
- Security and sanitization fixes for WP.org compliance (nonce handling, wp_unslash, input sanitization, GPL-compatible chart library).
- Compatibility check with WP and WooCommerce latest version.

= 2.1.7 =
- Fix errors related to validations, sanitizations and escaping.
- Compatibility check with WP and WooCommerce latest version.
