# Changelog

All notable changes to CitCom. User Insights are documented here.

---

## [2.0.1] – 2026-03-31

### Added
- **Product Insights: Wishlist tab on product profile** – each product's profile page now includes a _Wishlist_ tab listing every registered user who has saved that product to any of their WPC Smart Wishlists. Displays avatar, display name (linked to the CUI user profile), email address, and date added.
- **Wishlisted stat card on product profile** – a _Wishlisted_ stat box showing the total unique wishlister count appears alongside Views, Unique Viewers, Purchases, and Revenue (shown only when WPC Smart Wishlist is active).
- **Wishlisted column on product insights list** – a new _Wishlisted_ column showing the unique wishlister count per product is now visible in the product list table (shown only when WPC Smart Wishlist is active).
- **Wishlisted column is sortable** – clicking the column header sorts the full product list by wishlister count (ascending or descending). The sort uses a two-query batch approach to keep DB load minimal regardless of catalogue size.

---

## [1.1.1] – 2026-03-29

### Added
- **Product Insights feature** – dedicated product analytics list and per-product profile pages.
- Product list table with sortable columns: Views, Unique Viewers, Purchases, Revenue, Last Viewed, and Product Name.
- Per-product profile page with Viewers tab (registered users + guests) and Purchasers tab.
- Quick-filter "Popular (viewed within last 7 days)" restricts the list to products with at least one view in the preceding 7 days.
- Category dropdown filter on the product list.
- WP-style pagination with displaying-num count always visible.
- Product thumbnail and SKU columns in the list table.
- Branded eye-icon Insights button injected into the native WooCommerce product list column.
- Wishlist tab and Wishlisted stat card on per-product profile.

---

## [1.1.0] – 2026-03-28

### Added
- **WPConsent integration** – visit tracking is now gated behind statistics consent when the WPConsent (Cookies Banner & Privacy Suite) plugin is active.
- Frontend tracker script is registered with WPConsent via the `wpconsent_blocked_scripts` filter, so the script blocker prevents tracking until consent is given.
- Consent cookie category declared via the `wp_consent_cookie_info` filter for compatibility with the WP Consent API.
- JS tracker listens for the `wpconsent_consent_processed` event to retry tracking when a visitor accepts the banner mid-page (covers cases where the script blocker is not active, e.g. caching layers).
- Consent cookie name resolved dynamically via `apply_filters('wpconsent_frontend_js_data', [])` – supports per-site cookie name overrides (e.g. themes that rename the cookie from the default `wpconsent_preferences`).
- Lazy session creation in `ajax_track_visit()`: a session record is only created once consent has been confirmed, preventing orphan sessions.

### Changed
- Tracker script is now always enqueued on the frontend regardless of current consent state; the server-side AJAX handler is responsible for the consent gate.

---

## [1.0.0] – 2026-03-01

### Added
- Initial release.
- Page visit and session tracking for registered users and guests.
- Guest cookie management with checkout enrichment (classic shortcode and Block checkout).
- Guest-to-user transfer on login and WooCommerce account creation.
- Email-based deduplication and historical guest record merging.
- Admin dashboard list table with combined user/guest view.
- Individual user and guest profile pages with tabbed layout.
- WooCommerce combined stats (logged-in + guest orders by billing email).
- CRM Notes on user profiles (add, edit, delete).
- WPC Smart Wishlist integration.
- Device, browser, and OS detection via lightweight built-in user-agent parser.
- Settings page: toggle guest tracking, exclude roles, data retention, IP anonymisation.
- Danger Zone: wipe all plugin data without uninstalling.
