=== TagRudder Tracker ===
Contributors: tagrudder
Tags: tracking, woocommerce, gtm, ga4, facebook capi, conversion, server-side, tagging, analytics, pixel
Requires at least: 5.6
Tested up to: 6.5
Requires PHP: 7.4
Stable tag: 2.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect WordPress / WooCommerce to TagRudder server-side tracking. Bypass ad blockers, recover lost conversions, and improve ROAS — with or without Google Tag Manager.

== Description ==

TagRudder Tracker is the official WordPress plugin for [TagRudder](https://tagrudder.com/) server-side tracking.

* Works **with** Google Tag Manager (drop your GTM container ID in and we route it through your TagRudder subdomain).
* Works **without** GTM for server event logging or Server Pixel API plans. Legacy direct pixel forwarding plans are discontinued.
* Captures every WooCommerce conversion **server-side** so you never lose a purchase to ad blockers, slow networks, or bounced JavaScript.
* Auto-collects identity + click ID signals (fbclid, gclid, gbraid, wbraid, gad_source, msclkid, ttclid, twclid, dclid, GA client_id) and stitches them to the TagRudder UID system for cross-session attribution.
* Sets `external_id` from the first-party `tr_uid` cookie for stronger Meta CAPI / TikTok / Snap match quality.
* Background heartbeat so your TagRudder dashboard knows the install is healthy.
* Tiny retry queue if a conversion fails to deliver — it's replayed on the next cron tick.
* Optional WooCommerce order-status and refund webhook events through TagRudder's authenticated event-log endpoint.
* Optional Customer Match scaffold queues consented SHA-256 WooCommerce identifiers for manager-side audience sync.
* Cookie Keeper / custom-loader controls for first-party UID, UTM, click-ID lifetimes, redundant storage, and server refresh behavior.
* Tabbed admin with install health, plan & usage card, masked API key (Reveal-on-demand), one-click key rotation, and capability-aware forwarding status.

== Installation ==

1. Upload the plugin to `/wp-content/plugins/` or install through the WordPress admin (Plugins → Add New → Upload).
2. Activate the plugin.
3. Go to **Settings → TagRudder Tracker**.
4. Generate a *Plugin API key* from your [TagRudder dashboard](https://tagrudder.com/user) and paste it in.
5. Click **Save settings**. The plugin will validate the key, fetch your tracking domain config, and start sending data.

== Frequently Asked Questions ==

= Do I need Google Tag Manager? =

No. The plugin works in three modes:

* **GTM mode** — paste your GTM container ID and we route GTM through your TagRudder subdomain.
* **No-GTM mode** — we load the TagRudder tracker bundle and send server event logs to TagRudder. Direct platform forwarding is discontinued unless your manager deployment explicitly re-enables it.
* **Server-only** — no browser scripts at all, only PHP-side conversions reach TagRudder.

= Will this slow my site down? =

No. The injected script is a single async tag. The server-to-server purchase write happens after WooCommerce already sent the order to the customer.

= How is my data handled? =

Email, phone, name, and address are SHA-256 hashed by default before they leave WordPress. Your API key is encrypted at rest using your site's `AUTH_KEY` salt. Consent Mode v2 signals are forwarded if you enable them.

= Is WooCommerce HPOS supported? =

Yes — the plugin declares compatibility with WooCommerce custom order tables (HPOS).

= What happens if my TagRudder site is unreachable for a moment? =

Failed events are saved to a small retry queue and resent automatically on the next WP-Cron tick.

== Changelog ==

= 2.0.0 =
* Major Release: Rebranded completely to TagRudder Tracker with official Electric Indigo and Cyber Cyan theme.
* High-resolution embedded brand logo with retina vector support.
* Synchronized self-hosted automatic update system with TagRudder Cloud.
* Automatic migration and clean deactivation of legacy BonicBD companion plugin.
* Hardened container and webhook authentication.


= 1.21.17 =
* Fixed (fatal): `Call to undefined method TagRudder_Order_Tracking::should_track()` crashed every thank-you page and the fallback purchase detector. The method never existed although `should_track_purchase()` called it. It now exists (missing order, cancelled/refunded/failed and already-skipped orders are not trackable), and every accessor on the class is null-safe, so a deleted or half-hydrated order can no longer take the page down.
* Fixed (fatal hardening): the purchase guard now returns "skip" instead of throwing when the order object is incomplete.
* Fixed: the Pixel-API (`pixel_v2`) render path read an undefined `$cid`, so its consent bridge was emitted with an empty container id.
* Fixed (double-load): every footer module and the GTM body snippet are now emitted once per request. Page builders and AJAX re-renders that fire `wp_footer`/`wp_body_open` twice used to duplicate the tracker, the GTM loader, the consent bridge, the pixel block and each optional module snippet — double-counting the events they track.
* Added: regression tests (`tests/`) covering the fatal above and one-copy-per-page rendering, plus a check that the plugin ships no copy of the shared `tagrudder-tracker-integrated.js`.

= 1.21.16 =
* Removed: The BazarBD module is gone entirely (panel page, sidebar entry, REST routes, courier/license/sync classes, options and cron cleanup).
* Fixed: The Save settings button silently failed — the `wp_ajax_tagrudder_*` handlers (including the visitor custom-event dispatch) were never registered on `admin-ajax.php`, so WordPress answered `0` and nothing was saved. The admin class now loads for `tagrudder_*` AJAX actions.
* Fixed: The sticky save bar no longer floats over page content (it covered the "Backup & migration" section).
* Improved: GTM Mode has priority — once an admin explicitly saves GTM Mode, the server `mode_hint` can no longer auto-switch the site to another mode. Other modes are unchanged.

= 1.21.15 =
* Fixed: The browser fingerprint used a 32-bit hash, so distinct visitors collided on the same value and the server merged their events onto one identity. It is now a 64-bit hash. In production, 17,709 identity rows shared a fingerprint with another visitor.
* Improved: An existing `tr_fp` cookie is still reused as-is, so a returning visitor keeps the history already recorded under it.

= 1.21.14 =
* Fixed: Rate limiter IP extraction now trusts only the direct connection address for public peers; proxy headers can no longer override the throttling bucket.
* Fixed: Script output (dataLayer / footer / inline script) escapes JSON with `JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP` to prevent script-breakout XSS.
* Improved: `client_ip_address` now prefers the direct `REMOTE_ADDR` on public peers.
* Improved: `TagRudder_Admin` (96KB) is no longer loaded/instantiated on `admin-ajax` requests.
* Improved: Retry-queue attempt thresholds unified to 5 (max attempts / DLQ / failing bucket).
* Improved: Order tracking now marks terminal (cancelled / refunded / failed) orders so a reopened order cannot re-fire a purchase.

= 1.21.13 =
* Fixed: Incomplete Order "real orders captured as incomplete" — abandoned cron now skips snapshots that already have a real WC order; autoload bypass fixed via canonical writer.
* Fixed: Incomplete edit now supports `billing_state`/`shipping_state` (were silently missing from allowlist).
* Fixed: Incomplete "Create Order" (Confirm) now fires a full Purchase to the server (ledger `/c/<cid>/ledger/conversion` → `/evt` + `/g/collect` fanout) via `confirm_incomplete_purchase()` — previously only saved a local `recovered` row, so `/c/<cid>/events/log` and pixel forwarding never saw it.
* Fixed: Order block bypasses closed — `woocommerce_checkout_create_order` + `woocommerce_rest_pre_insert_shop_order_object` + `transition_post_status(trash)` veto, trusted-peer IP check, lower address-field threshold, signed checkout-timer HMAC, cross-request history lock, and broader email alias stripping (non-Gmail too).
* Improved: Rate limiter IP extraction now mirrors Fraud Shield trusted-peer logic.

= 1.21.12 =
= 1.21.12 =
* Security: Self-hosted updater now allowlists the download host (`panel.tagrudder.com`) and verifies `checksum_sha256` before an upgrade is applied — tampered or off-host ZIPs are rejected.
* Security: Plugin API key now binds to a per-key `site_secret` with `X-TagRudder-Site-Proof` (HMAC `tagrudder-site|<host>`) — reuse on another domain is blocked; secret is encrypted at rest.
* Security: API key rotation is now atomic (SQLite transaction) — no orphan window on double-rotate.
* Security: Removed `?plugin_key=` query-param fallback — keys no longer leak to access logs or referrers; unified hash secret to `FLASK_SECRET_KEY`.
* Improved: Bumped version strings and rebuilt signed release artifact.

= 1.21.10 =
* Fixed: Self-hosted update checks are now enabled by default — `enable_auto_update` previously defaulted to off, so sites that never visited the Features tab never saw new versions in wp-admin (the plugin is not on wordpress.org, making /plugin/info the only update channel).
* Added: One-time migration enables update checks on existing installs and clears the cached release-info transient so the new version is discovered on the next update check. Admins can still opt out via Features → update checks.
* Improved: The Features settings text now explains that update checks are the only delivery channel for new releases.

= 1.21.9 =
* Fixed: `view_item` (ViewContent) now fires on block-based product templates and page builders where the classic `woocommerce_after_single_product` hook never runs — a wp_footer fallback re-detects the single-product context and emits the event once.
* Fixed: Consent Mode bridge now tracks real CMP behaviour — `gtag('consent','update')` calls and `['consent','update',state]` dataLayer pushes (Complianz, Cookiebot, CookieYes, Cookie Notice and similar) update `TagRudderConsent.state`, so consent-gated pixels actually unlock when visitors consent through a standard CMP.
* Fixed: CMP `consent default` pushes carrying a returning visitor's stored choice are merged into `TagRudderConsent.state` without triggering a server POST on every pageview.
* Fixed: Consent-gated pixel bootstrap now also polls `TagRudderConsent.state` briefly as a safety net so pixels still initialise if a CMP's consent signal arrives through an unrecognised channel.
* Fixed: `view_item` no longer emits an empty ecommerce item when the product payload is unavailable.

= 1.21.8 =
* Fixed: GA4 browser dispatch crashed with a JavaScript ReferenceError (`ec` undefined) — all mapped GA4 ecommerce events now fire correctly.
* Fixed: Consent readers now read the canonical `window.TagRudderConsent.state` object — previously they checked `window.TAGRUDDER_CONSENT` which was never defined, so consent-gated checkout PII, incomplete-checkout capture, email enrichment, and custom events were silently rejected.
* Fixed: `add_to_cart` no longer double-fires — the pixel bridge now defers to the dedicated WooCommerce AJAX dataLayer listener instead of dispatching a second copy with a fresh random event ID.
* Fixed: `remove_from_cart`, `coupon_applied`, and `coupon_removed` events are no longer lost on wc-ajax and Store API (Cart & Checkout Blocks) requests — they are deferred and emitted on the visitor's next rendered page.
* Fixed: `login`, `sign_up`, `logout`, `search`, `form_submit`, and `comment_posted` events now survive POST→redirect flows — queued dataLayer payloads persist across redirects and flush on the next pageview.
* Fixed: Browser-side server backup now fires even when every ad pixel is blocked by an ad-blocker — previously the backup only ran when at least one browser pixel succeeded, defeating its purpose.
* Fixed: TikTok PageView now uses the canonical `ttq.page()` call with `event_id` for proper browser↔server deduplication.
* Fixed: `pixel_v2` checkout-step relay and browser push now share the same event ID, so Meta/TikTok deduplicate `add_shipping_info`/`add_payment_info` correctly.
* Fixed: Server-side purchase delivery in non-GTM modes is no longer suppressed — the thank-you footer flush no longer prematurely marks the order as server-tracked, so the async purchase cron actually delivers.
* Fixed: Purchase fallback detection now applies the same order-status gate as the primary path — pending/failed orders no longer emit browser purchase events on custom thank-you pages.
* Fixed: Incomplete-orders CSV export sends Content-Type/Content-Disposition headers before output and escapes spreadsheet formula-injection cells (`=`, `+`, `-`, `@`).
* Fixed: Retry-queue flush is serialized with a MySQL named lock so overlapping cron workers cannot double-send queued events; cross-session dedup is now an atomic `INSERT IGNORE` claim; retry-path successes record dedup keys; expired dedup rows compare against UTC consistently.
* Fixed: Admin incomplete-order edits now write through the canonical storage writer, preserving sort order, the 250-record cap, and `autoload='no'`.
* Improved: `sign_up`, `login`, `search`, and `form_submit` events are now mapped to platform standard events (CompleteRegistration/Search/Lead, TikTok, Snap, GA4) so they reach Meta/TikTok/Snap/GA4 pixels instead of staying dataLayer-only.
* Improved: When consent mode is enabled, Meta/TikTok/Snap/GA4 pixel bootstrap and PageView calls are deferred until consent is granted, with a dataLayer re-scan on consent update.
* Improved: Front-end server event delivery is deferred to request shutdown (after `fastcgi_finish_request` where available) so page renders no longer block on the manager API round-trip; failures still land in the same retry queue.
* Improved: Store currency is now injected into the JS bridge so `BDT` is no longer hardcoded as the fallback currency on non-BDT shops.
* Improved: Server-side consent checks now also recognize common CMP cookies (Complianz, Cookiebot, Cookie Notice) when the explicit consent flag is absent.
* Improved: `view_item_list` item index is now 0-based per the GA4 ecommerce spec; `server_only` mode events now carry guest-identity `user_data`.
* Maintenance: Removed dead code and files — the unreachable page-view dedup cookie mechanism, the `build_tabs()` shim, and three unused admin view partials plus a legacy CSS backup.

= 1.21.4 =
* Fixed: Added a classic WooCommerce `woocommerce_checkout_process` validation fallback so hard Fraud Shield rules reliably stop order creation and show the existing popup before an order is created.
* Improved: Prevented duplicate Fraud Shield and rate-limiter validation/logging within the same classic checkout request.

= 1.21.3 =
* Maintenance: Rebuilt the Fraud Shield hard-block release with the latest WooCommerce Blocks popup and order-validation fixes.

= 1.21.2 =
* Fixed: All hard Fraud Shield blocks now share the existing Order Blocked popup and stop new order creation on classic and WooCommerce Blocks checkout.
* Fixed: Store API IP-rate-limit failures now use a proper WooCommerce checkout validation exception instead of a generic exception.
* Changed: Session rate limiting remains friction-only with its existing countdown behavior and does not hard-block orders.

= 1.21.1 =
* Improved: Redesigned the Fraud Shield admin tab with a clearer intro panel, visual section hierarchy, grouped controls, stronger card spacing, and responsive mobile styling.
* Fixed: Fraud Shield now always displays the Trash order status when WooCommerce provides its own order-status list.

= 1.21.0 =
* Security: WooCommerce REST consumer credentials are no longer included in order or customer payloads sent to TagRudder.
* Security: Added IP-based rate limiting and payload-size limits to public AJAX endpoints to reduce abuse and spam.
* Privacy: Personally identifiable visitor data is captured and forwarded only after explicit browser consent.
* Maintenance: Uninstall now removes plugin-owned options, custom tables, sensitive metadata, rate-limit state, salts, and scheduled hooks.
* Fixed: Queue flush statistics now come from the database-backed queue, keeping the admin UI synchronized with actual queue state.
* Fixed: Event source URLs now resolve to the actual page/path instead of incorrectly falling back to the homepage; GTM dataLayer payloads include page URL fields.
* Improved: Fraud Shield supports the Trash order status, reliably renders the IP denylist, and groups settings into clearer admin sections.
* Improved: Fraud Shield order-status handling and settings sanitization now support the expanded status list.
* Maintenance: Converted settings arrays to the project’s WordPress Coding Standards-compatible `array()` syntax.

= 1.20.9 =
* Fixed: Admin save notification now renders with inline fallback styles, so the toast always shows even if the CSS file is cached.

= 1.20.8 =
* Fixed: Admin settings AJAX save no longer double-checks the wrong nonce, so the 'Settings saved' notification appears again.

= 1.20.7 =
* Improved: checkout autofill detection for email, phone, name, city, state, ZIP, and country — hashes captured values before sending.

= 1.20.6 =
* Fixed: Legacy queue dedup_key index is now UNIQUE so ON DUPLICATE KEY UPDATE actually prevents duplicate retry rows on concurrent event enqueue.
* Improved: Phone number normalization (country code prepend, leading-zero strip) and address field hashing are now centralized and UTF-8 safe for Meta CAPI.
* Audit: Purchase/order event paths now guarantee one browser or server send per order via order meta flags, deduplication tables, and retry queue guards.

= 1.19.3 =
* Added: Fraud Shield now supports configurable order statuses for duplicate detection (`fraud_block_statuses`), with admin UI checkboxes and sanitization.

= 1.19.2 =
* Maintenance release: latest fixes and improvements.

= 1.19.1 =
* Fixed: Admin UI and WordPress admin menu icons were hidden because the CSS globally hid `[aria-hidden="true"]`. Decorative SVG icons and dashicon fallbacks now render correctly.

= 1.19.0 =
* Added: Email/Phone Enricher now supports first name, last name, city, state/region, ZIP/postcode, and country capture, with per-field admin toggles and CAPI-ready SHA-256 hashing in the browser.
* Improved: Guest identity cache, WooCommerce user_data, Pixel V2 payloads, and the shared GTM tracker all consume the extended PII signals for higher event match quality.

= 1.18.7 =

= 1.18.6 =

= 1.18.1 =
* Fixed: IP and Session rate limiting did not apply to Cart & Checkout Blocks (Store API) — only classic shortcode checkout was throttled. Rate limiter now hooks into woocommerce_store_api_validate_checkout so block-based stores get IP + session rate enforcement.
* Fixed: Fraud Shield's "Order Limit" time window was silently overridden by the "Lookback window" (days) setting. A configuration of "2 orders per 24 hours" with 30-day lookback applied a 30-day window, not 24 hours. History-based checks now respect the hours dropdown; lookback_days is only used by the live order query.
* Fixed: AddShippingInfo / AddPaymentInfo still shipped value=0 on sites where the WooCommerce cart session wasn't loaded during admin-ajax requests. The checkout-step handler now force-loads the cart when needed.
* Added: view_item_list events now map to Meta's "ViewCategory" standard event (previously sent as a custom event). Server Pixel v2 and GTM mode both benefit — the browser EVENT_MAP already had this mapping, the Meta CAPI adapter was missing it.

= 1.18.0 =
* Fixed: Name-Based Email Signal and Guest Identity Cache toggles in Features tab were not saving — the checkboxes appeared in the UI but were absent from the admin save handler, so toggling them had no effect after page reload.
* Added: Scroll Depth milestone selection — admins can now pick which scroll percentages fire events (25%, 50%, 80%, 100%). Previously only a single "start from" threshold existed. Each selected milestone fires a separate scroll_depth event with full payload.
* Added: scroll_depth and exit_intent events added to the browser pixel bridge EVENT_MAP so they fire GA4 gtag() calls when browser pixels are active.
* Improved: ViewCategory (view_item_list) in Server Pixel v2 mode now sends full ecommerce data (value, content_ids, contents, item_list_id, item_list_name) plus EMQ PII via the canonical payload builder. Previously it sent only currency + content_type with no item/value data.
* Fixed: Custom Events Module → Event Flow card CSS — step text was touching the card border with no spacing. Steps now have proper padding, background, numbered badges, and arrow separators.
* Fixed: AddShippingInfo / AddPaymentInfo events were sending value=0 because build_content_aliases_from_items() does not compute a sum. The checkout step AJAX handler now resolves the real cart total from WC()->cart as the event value.
* Fixed: Fraud Shield was not blocking repeat orders in WooCommerce Cart & Checkout Blocks. The Store API validation hook does not populate $_POST, so checkout_address_fingerprint_from_post() returned empty and address-based duplicate detection silently passed. Customer billing fields are now mirrored into $_POST before the duplicate check runs.
* Added: Fraud Shield block popup — when an order is blocked, a modal popup with the configured block message (plus optional support phone / WhatsApp contact) is now shown on the checkout page. Previously the session flag was set but never rendered, so customers saw a silent rejection with no explanation.
* Changed: Fraud Shield duplicate detection intentionally EXCLUDES 'completed' orders — a customer whose previous order reached Completed is allowed to place a new order. Only pending/processing/on-hold/failed/cancelled orders are treated as "still in flight" duplicates.

= 1.17.0 =
* Fixed: Checkout step events (AddShippingInfo, AddPaymentInfo) were firing twice with identical data, triggering Meta's "fired 2 times with identical data" warning. In pixel_v2 mode the server relay delivered the event via CAPI, but the dataLayer push with tagrudder_event_name=ga4EventName also triggered the browser pixel bridge to fire it again with a different event_id. The canonical ga4EventName push is now gated behind actual browser-pixel activity so it only fires when browser pixels are loaded — no more duplicate.
* Fixed: Server Pixel v2 events (view_item, page_view, view_item_list, add_to_cart, view_cart, begin_checkout) showed only the site domain root as the event_source_url instead of the real page URL (e.g. /product/tr140/). dispatch_pixel_v2_ecommerce_event() now resolves the canonical storefront URL from the product/archive permalink instead of relying on REQUEST_URI, which returns the wrong path behind page caches (Cloudflare / LiteSpeed / WP Rocket) and reverse proxies.

= 1.16.0 =
* Major: Server Pixel v2 Event Match Quality (EMQ) overhaul — addresses low external_id coverage, broken browser/server deduplication, missing PII on funnel events, and bot-inflated page views.
* Fixed: Browser/server event_id deduplication was broken for every non-purchase event. The JS pixel bridge regenerated a fresh event_id when it fired >15s after PHP render, so Meta saw browser and server events as two separate events (causing the 1,961 server vs 538 browser mismatch). The PHP event_id is now authoritative; the JS bridge always reuses it. Deduplication now works for view_item, add_to_cart, begin_checkout, add_payment_info, add_shipping_info, etc.
* Added: Logged-in user PII (hashed email, phone, first/last name, city, state, zip, country) is now attached to every Server Pixel v2 event — not just purchase. Previously page_view, view_item, view_item_list, add_to_cart, view_cart, begin_checkout, remove_from_cart, and coupon events were sent without any user_data, capping their EMQ at the IP+UA baseline. Lifts EMQ +2 to +4 points across the funnel for logged-in visitors.
* Added: Checkout step events (add_shipping_info, add_payment_info) now capture the live billing_email and billing_phone the user typed into the checkout form. The JS relay sends them to the server, which SHA-256 hashes them before forwarding. These peak-intent events previously carried only cart items; expect +4 to +6 EMQ points on AddPaymentInfo.
* Fixed: Bot/scanner/internal-traffic filtering for pixel_v2 page_view was entirely missing — every bot probe of /wp-admin, /.env, /xmlrpc.php fired a page_view that consumed forwarding quota and polluted Meta. page_view now filters 404s, feeds, robots, REST, cron, scanner paths, 30+ crawler user agents (googlebot, bingbot, bytespider, gptbot, semrushbot, ahrefsbot, curl, wget, python-requests, headless, phantomjs, etc.), and logged-in admins/shop managers.
* Fixed: AJAX-relayed events (add_shipping_info, add_payment_info, scroll_depth, exit_intent) showed only the site domain (or /wp-admin/admin-ajax.php) as the event_source_url because the browser never sent the real page URL. All JS relays now send window.location.href, page_path, and document.referrer; the AJAX handlers thread them into the canonical payload so Meta sees the actual page (/checkout, /product/xyz, etc.).
* Fixed: build() now honors browser_signals['referrer'] for AJAX-relayed events instead of falling back to the admin-ajax.php request referer.

= 1.13.3 =
* Improved: Orders are now synced in paged batches of 200 instead of loading up to 200,000 at once, preventing memory exhaustion and timeouts on large catalogs.
* Fixed: `build_order_payload` divide-by-zero and null-product access guards for incomplete/cancelled orders.
* Fixed: `build_product_payload` now null-guards `get_stock_quantity()` and `get_low_stock_amount()` (absent on some WC versions / variation parents).
* Fixed: `build_customer_payload` wrapped in try/catch with null-safe date access.

= 1.15.0 =
* Major: Fraud Shield rewritten to match the duplicate-order-blocker specification — now a powerful pre-save blocking engine.
* Added: Honeypot trap — invisible field on checkout form; bots that fill it are instantly blocked.
* Added: Quick-submission protection — orders submitted faster than `min_checkout_seconds` (default 3s) are blocked as bot activity.
* Added: `tagrudder_device_id` cookie (32-char hex) — dedicated device tracking cookie per the spec; collected alongside legacy `tr_fp`.
* Added: BD phone normalization — all Bangladesh phone formats (017XXXX, +88017XXXX, 88017XXXX, spaces, dashes) normalized to canonical `0XXXXXXXXXX` before duplicate matching.
* Added: Gmail dot/plus trick protection — `user+1@gmail.com`, `u.s.e.r@gmail.com` normalized to root `user@gmail.com` before duplicate matching.
* Changed: Address fingerprint now uses sha256 of name+address+city (was md5 with postcode/country) per spec.
* Added: `woocommerce_checkout_process` hook for double protection (in addition to `woocommerce_after_checkout_validation`).
* Added: CartFlows AJAX checkout support — `cartflows_before_checkout_submit` hook now runs fraud checks.
* Added: Admin order meta display — IP address + first 10 chars of device_id shown on the order detail screen.
* Added: Popup auto-scroll — when a fraud block notice appears, the page auto-scrolls to it (smooth scroll).
* Added: New settings — `min_checkout_seconds` (3), `lookback_days` (30), `phone_display`, `phone_dial`.

= 1.14.1 =
* Fixed: external_id (tr_uid) was missing on AJAX-relayed server events (checkout steps, engagement) — build() now always collects browser signals from server-side cookies.
* Fixed: fbp was empty for organic (non-ad-click) visitors in Server Pixel API mode — a stable deterministic _fbp is now derived from tr_uid so Meta gets a consistent browser identifier.
* Fixed: GA4 browser events were completely suppressed in pixel_v2 mode — browser gtag() hits are now fired alongside server CAPI forwarding.
* Fixed: view_item_list browser pixel mapping was all-null (no Meta/TikTok/Snapchat) — now fires ViewCategory/ViewContent.
* Fixed: add_payment_info and add_shipping_info were server-only in pixel_v2 — checkout step JS now pushes to dataLayer so the browser bridge fires fbq/ttq/snaptr.
* Fixed: Custom Events rules disappeared after page reload — rules now auto-persist on "Add Rule" (no need to click "Save All Rules" separately).
* Improved: buildGa4Params helper added for proper GA4 browser event parameters (value, currency, transaction_id, items).

= 1.14.0 =
* Major: Fraud Shield now blocks on WooCommerce Cart & Checkout Blocks (Store API) — previously orders placed via block-based checkout bypassed all fraud rules entirely.
* Changed: Fraud Shield `fraud_monitor_only` now defaults to OFF so repeat-order blocking activates as soon as the toggle is enabled.
* Added: Fraud Shield now hard-blocks known disposable/temporary email domains (mailinator.com, guerrillamail.com, etc.) on checkout.
* Added: Video Tracker `enable_s2s` now activates automatically in Server Pixel API mode so video events reach the manager without a browser pixel.
* Fixed: Video Tracker, Scroll Tracker, and Exit Intent Tracker now run in Server Pixel API mode via an AJAX relay (previously they were silently skipped).
* Fixed: Custom Events "Server event (CAPI)" column was a no-op — the dispatch action now forwards through the canonical Pixel V2 pipeline.
* Fixed: Custom Events php_hook rules saved in the Unified Event Builder were unreachable at runtime — the resolver now reads both the new `tagrudder_custom_event_rules` option and the legacy `custom_event_mappings` setting.
* Fixed: `.tagrudder-cev-col` column layout on the Custom Events admin tab was broken (no CSS widths) — columns now render correctly.
* Fixed: Incomplete Orders list no longer shows orders that were actually placed — snapshot reconciliation now matches by email/tr_uid across AJAX capture and checkout submit.
* Fixed: Editing an Incomplete Order address fields now saves correctly (JS form payload was sending nested objects, PHP expected flat fields).
* Fixed: Checkout step events (add_shipping_info / add_payment_info) now dispatch server-side in Server Pixel API mode.
* Fixed: Meta & TikTok adapter event name mapping for add_shipping_info / add_payment_info.
* Added: Server Pixel API engagement relay endpoint for scroll_depth, exit_intent, and video events.
* Improved: Server Pixel API platform dropdown now shows all 7 supported platforms on paid plans; platform_count quota enforced on credential save.
* Improved: Partial credential re-save — already-saved fields are now recognised so users can add a single new credential without re-entering everything.
* Improved: Credential delete now hard-deletes the row (instead of a soft-delete that revived on next save).

= 1.13.2 =
* Fixed: `site_url` comparison on the manager sync endpoints (orders/products/customers) is now scheme-, www-, and trailing-slash-insensitive, preventing false `403 site_url mismatch` errors.

= 1.12.0 =
* Enhanced: Product sync payload now includes thumbnail image URL, regular price, manage_stock flag, weight, and last-modified timestamp.
* Enhanced: `build_product_payload()` and `post()` methods now public for external callers.

= 1.9.1 =
* Fixed: Sidebar active state now syncs with the in-page tab — clicking a tab (or deep-linking) highlights the correct sidebar item instead of leaving the whole section highlighted.
* Fixed: Sidebar items now actually switch panels when their hash links point to an in-page tab (hashchange routing added), instead of silently doing nothing.
* Fixed: Collapsed sidebar items now center properly (icon-only rail) and the brand logo centers when collapsed.
* Fixed: Ghost/secondary buttons now have visible borders so they're clearly clickable on light surfaces.
* Fixed: Insights page charts now re-render with correct dimensions when the tab becomes visible (previously canvases rendered at 0×0 while the panel was hidden).
* Fixed: TagRudder logo displays with its original orange color instead of being washed out by an invert filter.
* Improved: Add-to-denylist now accepts MULTIPLE IPs / CIDRs at once — paste a list separated by newlines, commas, semicolons, or spaces. Each is validated individually and the result message reports added / already-present / invalid separately.
* Improved: The Add IP field is now a textarea sized for lists, with a hint clarifying that adding is instant (auto-saved via AJAX, no Save button needed).

= 1.9.0 =
* New: Professional dashboard redesign with a fixed dark-navy collapsible sidebar, sticky topbar, and bold analytics-style stat cards.
* New: Dashboard home tab — a single at-a-glance view summarising tracking health, usage/quota, fraud blocks, incomplete orders, a readiness checklist, premium/plan status, recent fraud blocks, and quick actions. Covers data from every Flask endpoint (usage, billing, ops-center, heartbeat, premium gates) in one place.
* Redesign: Fresh CSS reset with a single design-token system (spacing, radius, typography, shadow, status scales) — replaced the legacy 101 KB ad-hoc stylesheet with a clean ~60 KB component library.
* Redesign: All sections restyled with the new bold dashboard look (orange accent, refined cards, toggles, tables, badges, charts). Light theme only.
* Improved: Sidebar navigation unifies all 14 sections (Dashboard, Setup, Tracking, Insights, Fraud, Incomplete, Help) in one persistent menu; collapses to an icon rail on desktop and an off-canvas drawer on mobile.
* Maintenance: Removed 101 KB of dead legacy JavaScript (admin.js) that was superseded by admin-core.js and never enqueued.
* Note: No dark mode (light theme only). All existing class names preserved for backward compatibility.

= 1.8.39 =
* Fixed: IP Denylist entries appeared to vanish on page reload — the JS renderer read an object shape while the store held plain strings, producing empty rows and broken Remove buttons. Entries are now normalized to a canonical {ip, added_at} shape on read (legacy data auto-migrates).
* Fixed: Remove IP always errored because the rendered data-ip attribute was blank; the normalize + renderer fix restores correct removal.
* New: "Test an IP" tool on the Fraud Shield tab — enter any IP and instantly see whether it would be blocked right now, which denylist rule (exact IP or CIDR) matches, the current rate-limit hit count, shield on/off, and Monitor-Only state. Removes the guesswork of "is blocking actually working?"
* Improved: Adding an IP that is already on the denylist now returns a friendly success message instead of an error, and still refreshes the list.
* Improved: ip_auto_added badges are cleaned up when an entry is manually removed.

= 1.8.38 =
* Refactor: Extracted incomplete order methods to dedicated trait (TagRudder_Incomplete_Orders) for better maintainability.
* Improved: Reduced CSS !important usage by using more specific selectors.
* Note: jQuery retained where WooCommerce core events require it (added_to_cart, updated_checkout, etc).

= 1.8.37 =
* Improved: Edit incomplete order modal redesigned with modern card-based layout, gradient header, and responsive design.
* Improved: Product line items now display as cards with +/- quantity controls instead of table rows.
* Improved: Address fields use 2-column grid layout for better organization.
* Improved: Form actions styled with gradient buttons and visual feedback states.
* Improved: Quantity controls include plus/minus buttons for easier editing.
* Fixed: Event handlers updated to work with new card-based line item layout.

= 1.8.26 =
* Fix: Incomplete orders list now correctly filters out real WooCommerce orders linked to completed/on-hold/cancelled purchases and displays them in a separate "Recovered" tab.
* Fix: Edit incomplete order modal now properly loads saved data via fetch mode before displaying the editor form.
* Fix: Queue database now uses UNIQUE constraint on dedup_key to prevent race conditions and silent duplicate enqueueing during concurrent requests.
* Fix: Event payload columns bumped from 120/255 to 190/500 characters to prevent silent truncation of long event names and messages.
* Improved: Dashboard performance — premium entitlement validation now cached per-request and throttled to 5-minute transient to eliminate repeated option lookups.
* Improved: Heartbeat health check now runs single aggregated query instead of separate COUNT operations for faster reporting.
* Improved: Plugin release info transient increased from 6 hours to 24 hours to reduce update-check overhead.
* Improved: Incomplete cart option now uses autoload='no' to prevent loading large checkout snapshots on every WordPress page load.
* Improved: Admin nonce verification reordered to conventional pattern — checks CSRF token before validating other form fields.
* Improved: Modal double-open protection added — prevents orphaned DOM elements when Edit button is clicked rapidly.
* Improved: Console error logging added to incomplete checkout capture fetch to aid network troubleshooting.
* Verified: Cron duplicate scheduling already prevented by existing wp_next_scheduled() checks.

= 1.8.28 =
* Release: Build 1.8.28 — small packaging bump after modal DOM fixes and capture behavior adjustments. Please verify modal layout and checkout capture on staging.


= 1.8.24 =
 
= 1.8.27 =
* Release: Build 1.8.27 — packaging incremental fixes and modal/capture improvements for staging.

* Improved: Incomplete Order Capture now saves non-sensitive checkout form inputs as soon as the customer actually enters data, even if they never click Place Order.
* Fix: Empty/default-only checkout states no longer create incomplete-order snapshots just because the checkout page loaded or a default payment method was preselected.

= 1.8.23 =
* Changed: Removed the admin `prefers-color-scheme: dark` stylesheet override so the plugin now stays in the standard light presentation.
* Improved: Refreshed the release package and WordPress update metadata for the light-only admin build.

= 1.8.22 =
* New: Diagnostics now includes a live event stream backed by persistent queue DB storage plus an admin refresh/polling view for recent delivery activity.
* Improved: TagRudder admin assets now boot from a lightweight core script and lazy-load Insights, Fraud Shield, and Custom Events modules only when needed.
* Improved: WooCommerce order identity stitching now schedules asynchronously via WP-Cron instead of performing the stitch inline during purchase flows.
* Improved: Release package refreshed for the Phase E/F diagnostics and admin performance updates.

= 1.8.21 =
* Improved: `TagRudder_Settings::get()` now uses a request-lifetime cache, keeping settings reads to a single `get_option()` query per page load and auto-flushing after writes.
* Improved: `TagRudder_Settings::defaults()` now uses a static cache to avoid rebuilding the defaults array on repeated access.
* Improved: `TagRudder_Queue_DB::stats()` now calculates total, overdue, and failing counts in one aggregated SQL query instead of three separate queries.
* Improved: `TagRudder_Queue_DB::ensure_dedup_column()` now uses a persistent transient cache so repeated requests do not keep issuing `SHOW COLUMNS` checks.
* Fix: Plugin deactivation now clears orphan async purchase cron hooks, including `CRON_ASYNC_PURCHASE`.
* Fix: Remaining 12s/15s plugin API client requests are now normalized to 8 seconds to reduce slow admin waits and long-running background calls.
* Improved: `TagRudder_Admin` is no longer loaded on front-end requests, trimming unnecessary memory usage outside admin, cron, and WP-CLI contexts.

= 1.8.20 =
* Fix: AJAX add-to-cart now pushes the full WooCommerce cart-fragment ecommerce payload to `dataLayer`, preserving value, items, currency, and event_id for GTM and browser pixel deduplication.
* Fix: Server Pixel API mode now accepts manager `pixel_v2` mode hints during plugin config sync.
* Fix: Tracker alias fallback now points to the generated first-party `/tagrudder-tracker-integrated.js` route, avoiding stale `/tagrudder-tracker-bundle.js` fallback misses.
* Improved: Pixel V2 payload privacy and match quality with canonical hashed email/phone aliases, stronger retry idempotency, and duplicate-skip observability.
* Improved: Admin mode detection now reads the active `mode` setting while keeping legacy fallback support.

= 1.8.19 =
* Fix: GTM mode now passes the saved GTM container ID to the first-party loader request, preventing empty loader requests on plugin-only setup.

= 1.8.15 =
* Fix: PageView event_id now shared between server CAPI dispatch and browser fbq call in pixel_v2 mode — Meta/TikTok/Snap correctly deduplicate the two hits instead of counting them twice.
* Fix: Removed sha256-hashed values from `email_address` / `phone_number` fields in user_data; hashes are now sent only in the correct `sha256_email_address` / `sha256_phone_number` fields.
* Fix: JS bridge no longer sends `order_id: ''` for non-purchase events; `order_id` is only included in the fbq / ttq payload when a transaction ID is present.
* Fix: `view_item_list` events are now dispatched via the pixel_v2 server path for analytics coverage.
* New: Added `add_shipping_info` (Meta: AddShippingInfo, TikTok: AddShippingInfo) and `add_payment_info` (Meta: AddPaymentInfo, TikTok: AddPaymentInfo) to the JS bridge event map.

= 1.8.14 =
* Fix: WooCommerce ecommerce events (AddToCart, ViewContent, InitiateCheckout, Purchase, etc.) now fire as browser fbq/ttq calls in Server Pixel API mode when Browser Pixels is enabled, making all events visible in Meta Pixel Helper.


= 1.8.13 =
* Fix: Browser pixel snippets (Meta fbq, TikTok ttq, Snap snaptr, Google gtag) are now injected in Server Pixel API mode when Browser Pixels is enabled, making them visible to Meta Pixel Helper and platform browser extensions.
* Improved: Forwarded Event Log capped at last 50 events, 10 per page (5 pages max) to keep the dashboard panel compact.

= 1.8.12 =
* Fix: `order_processing` webhook no longer fires in Server Pixel API mode, eliminating duplicate event in TagRudder dashboard.
* Fix: Purchase CAPI payload now includes full hashed billing address (first name, last name, city, state, postcode, country) for maximum Meta EMQ.
* Fix: `begin_checkout` now maps to Meta standard event `InitiateCheckout`; `view_cart` maps to `ViewContent`.
* Fix: `begin_checkout`, `view_cart`, and `view_item` pixel_v2 payloads now include `content_ids`, `contents`, and `num_items` for Meta CAPI quality.
* Fix: Conversion Ledger `dispatch_status` is now updated to `success` after a purchase event is successfully forwarded.
* Fix: Browser Pixels toggle is now unlocked for Server Pixel API plans — can be enabled for dual server+browser firing.
* New: `page_view` event is now dispatched server-side on every public page in Server Pixel API mode.

= 1.8.11 =
* Fix: Server Pixel API WooCommerce events no longer appear twice in TagRudder dashboard analytics.
* Fix: Saved Meta/TikTok/Snap test event codes now flow into Server Pixel API forwarding payloads.
* Fix: Insights charts now redraw after live data loads and when opening the Reports panel.
* Fix: Funnel events such as view_item, add_to_cart, and begin_checkout no longer inflate conversion health counts.
* Improved: Insights & Preview moved to a top-level TagRudder admin section beside Fraud Shield.

= 1.8.10 =
* Improved: Features tab now shows plan-aware locked/unlocked/premium badges for Server Pixel API, sGTM, server-event, and premium modules.
* Improved: Server Pixel API plans now lock GTM loader, tracker bundle, and browser pixels in the plugin UI with clear server-side explanations.

= 1.8.9 =
* Improved: Server Pixel API mode now captures TagRudder UID and ad click IDs with first-party PHP cookies, so browser loader/tracker module paths are not required.
* Improved: Admin readiness and identity screens now explain the server-side delivery path for Server Pixel API plans instead of showing managed browser module aliases.

= 1.8.8 =
* Fix: Server Pixel API frontend events no longer trigger a fatal error on product, cart, checkout, or order pages when building Pixel V2 identity payloads.
* Improved: Pixel V2 payload identity accessors now reuse the plugin's normalized browser-signal collection for _fbp, _fbc, and TagRudder UID values.

= 1.8.7 =
* Improved: Server Pixel API mode wording and release package updated for the latest TagRudder dashboard integration.
* Improved: Plugin build now ships the current Server Pixel API / Pixel V2 compatibility updates for WordPress update delivery.

= 1.8.6 =
* New: Tracking Readiness Score on the Tracking Overview tab with setup checks for connection, domain binding, server events, WooCommerce, click IDs, Cookie Keeper, Meta EMQ, consent, destinations, and retry queue health.
* New: Next best actions panel highlights the most important missing setup items and links directly to Tracking Diagnostics or Feature tuning.
* Improved: Overview UI adds a polished score card, readiness checklist, and direct tab-jump actions for faster setup.

= 1.8.5 =
* New: Security & Integrity Hardening diagnostics for API endpoint allowlisting, release checksum status, entitlement gates, browser write policy, and local file fingerprint.
* Improved: Premium Fraud Shield AJAX actions and incomplete-order actions now refresh manager entitlement before execution to reduce local option tampering risk.
* Improved: Admin diagnostics UI now surfaces recommended security actions in a clean checklist.

= 1.8.4 =
* New: Tracking + EMQ Diagnostics panel in Advanced Routing with Meta, Google Ads, GA4, TikTok, Snapchat, Microsoft, Pinterest, LinkedIn, and X readiness checks.
* New: Click ID Capture health cards show the manager-generated per-client module alias, supported click IDs, cookie prefix, and configured lifetimes without loading duplicate scripts.
* Improved: Identity signal checklist surfaces external ID, Enhanced Conversions, redundant storage, consent, and delivery-path readiness for faster troubleshooting.

= 1.8.3 =
* Fix: Server Configuration details now refresh instantly after API key save, test, or rotation without requiring an admin page reload.
* Fix: Feature tab settings now persist all v1.8 feature toggles and related fields through AJAX saves.
* Improved: Custom Event Builder moved into the Custom Events tab with edit, copy, delete, and toast-based save feedback.
* Improved: Admin UI refreshed with a professional card-based layout while preserving the TagRudder orange palette.

= 1.8.2 =
* Fix: Queue Status chart now correctly renders inside the Health sub-tab (was outside all panels, causing a duplicate-looking section below the tabs).
* New: Queue Status doughnut chart — queued / overdue / high-attempts breakdown.
* New: S2S Delivery Rate line chart in Reports — daily success percentage from trend data.
* New: Custom Event Builder — no-code CSS-selector-based dataLayer event rules with add/delete/save admin UI and frontend listener script.

= 1.8.1 =
* Fix: Insights page restructured — stats summary row above health card, charts moved to top of Reports panel.
* Fix: Inspector filter row compacted with grouped action buttons.
* Removed dark mode CSS (no longer needed).

= 1.8.0 =
* New: DB-backed retry queue (`wp_tagrudder_queue`) replaces options-based queue, eliminating race conditions under concurrent requests.
* New: Async purchase delivery — thank-you page fires a WP-Cron single event instead of blocking on the CAPI HTTP call.
* New: AJAX add-to-cart fix — full GA4 payload returned via WooCommerce cart fragment so the browser dataLayer push is never lost.
* New: COGS / Profit tracking — server-side purchase events include `cogs` and `profit` fields from a configurable product meta key.
* New: Stock urgency data — `stock_status` and `stock_quantity` appended to product-level payloads.
* New: Server-managed FPID cookie — HTTPOnly, SameSite=Lax first-party identity cookie set via WordPress AJAX handler.
* New: Consent Mode V2 S2S signals — reads Cookiebot/Complianz consent cookies and synthesises `gcs`/`gcd` fields for CAPI compliance.
* New: WooCommerce Subscriptions S2S — fires `renewal_purchase` server event on every successful subscription renewal.
* New: Video tracking module (`tagrudder-video-tracker.js`) — YouTube iFrame API + Vimeo Player SDK milestone tracking → dataLayer.
* New: Form abandonment tracking module (`tagrudder-form-tracker.js`) — CF7, Gravity Forms, and generic HTML form tracking.
* Improved: Admin dark mode CSS + micro-animations (ripple, save pulse, notice slide-in, stat card lift).
* Improved: Chart.js event delivery and event-type charts in the Insights tab.
* Improved: Features tab now exposes all new v1.8 settings in accordion sections.

= 1.7.6 =
* Change log: New Ui Improvment & Bug fixed.
* Improved: Refined the plugin admin experience with the latest interface updates already present in the current build.
* Fixed: Included the latest bug fixes from the current plugin codebase in this release refresh.

= 1.7.4 =
* Maintenance: Promoted the latest TagRudder Tracker build as the new live release package.
* Includes: The current Insights & Preview admin tab, real-time Event Inspector, GTM Preview Header tools, anomaly alerting, and attribution reporting improvements already implemented in the plugin UI.
* Improved: Refreshed the distributed release metadata and `latest` package for WordPress update delivery.

= 1.7.3 =
* New: Added a new **Insights & Preview** tab in the WordPress plugin admin with live operational tools for TagRudder-connected workspaces.
* New: Added a real-time Event Inspector UI in WordPress with search, platform filtering, pagination, manual test event generation, and inspector buffer clearing.
* New: Added GTM Preview Header management inside the plugin UI, including save/enable, disable, preview test event dispatch, and an **Open GTM Preview** shortcut.
* New: Added a zero-conversions-in-last-24-hours anomaly alert card using manager-side measurement health and recent baseline comparisons.
* New: Added an Order Attribution Report in the plugin UI built from request-inspector signals plus authoritative server-side conversion records.
* Improved: Plugin admin now uses dedicated manager-side `/plugin/*` endpoints for ops-center, inspector, and preview actions so browser requests stay behind authenticated WordPress AJAX proxies.

= 1.7.2 =
* New: Plugin settings now save via AJAX in WordPress admin, including Tracking Mode, GTM ID, and connection settings, without a full page reload when JavaScript is available.
* Improved: AJAX save reuses the same backend sanitization and validation path as the normal form submission, while preserving the non-JavaScript fallback.
* Security: AJAX settings save responses no longer echo sanitized settings payloads back to the browser.

= 1.7.1 =
* Fix: `render_incomplete_orders_page()` no longer references undefined `$kind` and `$section` variables — the notice badge now correctly shows success/error styling.
* New: Diagnostics Health section now shows an OpenSSL Encryption card indicating whether API keys are stored encrypted or plaintext, with guidance when `php-openssl` is unavailable.
* Improved: Heartbeat payload `features` array now includes `fraud_shield`, `incomplete_capture`, and `purchase_trigger` flags so the TagRudder dashboard can report accurate feature adoption.
* Improved: WooCommerce Events module description in the Features tab now lists `add_shipping_info` and `add_payment_info` alongside the other GA4 ecommerce events.

= 1.7.0 =
* Security: Encryption key derivation now uses a stable per-site salt stored in the database instead of `home_url()`, preventing key loss after domain migration. Automatic decryption migration from the legacy key format is included.
* Security: Cookie values used for click-ID stitching now use ASCII-safe filtering instead of `sanitize_text_field()`, preserving base64 characters in `_fbp` / `_fbc` values.
* Security: Updater now verifies that the version in a downloaded plugin ZIP matches the version advertised by the TagRudder API before the upgrade is applied.
* Security: Incomplete-order admin action now validates the cart key exists before executing the nonce check, preventing timing-based information leakage.
* Fix: Purchase event transient lock prevents duplicate `purchase` dataLayer pushes when multiple WooCommerce hooks fire simultaneously.
* Fix: Store API checkout (block checkout) now correctly clears the incomplete-order snapshot after payment instead of operating on `order_id=0`.
* Fix: Consent mode gate now blocks identity pings and incomplete-capture AJAX when consent is required but not yet granted.
* Fix: IPv6 CIDR notation in Fraud Shield denylist now evaluated correctly; previous code was IPv4-only and would silently pass all IPv6 addresses.
* Fix: Concurrent Fraud Shield `place_holds()` calls now use a transient lock to prevent race conditions under burst traffic.
* Fix: MutationObserver in the fingerprint module now disconnects after first successful field injection, preventing unbounded DOM observation.
* Fix: Server event retry queue now logs permanently-dropped events to the PHP error log and fires a `tagrudder_event_delivery_failed` action hook.
* Improved: Purchase payloads with more than 100 line items are truncated to prevent server-side API rejection on large orders. Limit is filterable via `tagrudder_max_purchase_items`.
* Improved: Admin notice displayed when the PHP `openssl` extension is missing, explaining that API key encryption is unavailable.
* New: `add_shipping_info` and `add_payment_info` GA4 ecommerce events are now pushed to `dataLayer` when the customer interacts with the WooCommerce checkout form.
* New: All dataLayer event pushes now include a `page_type` field (`product`, `category`, `cart`, `checkout`, `order-received`, `shop`, `search`, `other`) for GTM variable mapping.

= 1.6.27 =
* Fix: Active paid sGTM clients can now enable Fraud Shield and Incomplete Order Capture even when a newer renewal/application row exists for the same CID.
* Security: Premium feature toggles now refresh entitlement directly from TagRudder during admin page load and settings save, so browser inspector edits cannot activate locked features without server approval.

= 1.6.26 =
* Added: Captured Checkouts now support bulk selection/actions for Complete, Hold, Cancel, and Delete.
* Improved: Complete/Hold/Cancel now create or update real WooCommerce orders with the matching status; Delete only removes the captured row and never creates an order.
* Improved: Complete from Captured Checkouts fires a real server-side Purchase for the WooCommerce order with captured identity/click signals for stronger match quality.
* Security: Fraud Shield and Incomplete Order Capture now require an active paid TagRudder plan, with plugin-side locks and manager-side event ingestion enforcement for free trial, suspended, expired, or inactive workspaces.

= 1.6.25 =
* Fix: WordPress Plugins page update metadata now includes the plugin name, target version, version details data, and clearer “Update to TagRudder Tracker x.x.x” action text.
* Improved: TagRudder `/plugin/info` release metadata now exposes name, slug, plugin basename, compatibility fields, homepage, and upgrade notice for WordPress update UI consumers.

= 1.6.24 =
* Improved: Incomplete Orders table now has a cleaner full-width card layout, status pills, compact billing/total columns, and polished action buttons for Preview, Complete, Hold, Cancel, and Delete.
* Improved: TagRudder admin pages now use the available WordPress admin width instead of being constrained to a half-page layout.
* Fix: Fraud block popup Close button no longer immediately reopens from the WooCommerce AJAX checkout error marker.

= 1.6.23 =
* Added: Custom Events module with admin-managed GTM/dataLayer mappings for any custom event key fired through `tagrudder_tracker_custom_event`.
* Added: Incomplete Orders admin page with captured checkout inputs, cart items, external ID/click ID/browser signals, preview, hold/cancel/delete, and Complete → server Purchase event dispatch.
* Improved: Incomplete Order Capture now saves live checkout field snapshots and marks abandoned/placed records instead of using lightweight delete-only snapshots.
* Improved: Fraud Shield block popup now appears on Place Order attempts and can show Call Support + WhatsApp buttons from saved settings.
* Improved: Fraud Shield now enforces denylisted IPs even in monitor mode, adds temporary checkout holds to reduce rapid repeat-order bypasses, and strengthens delivery-address matching.

= 1.6.22 =
* Improved: Plugins page now includes a manual “Check updates” action (when TagRudder-hosted update checks are enabled) and a direct “Update to x.x.x” link when a newer release is available.
* Fix: Self-hosted update detection now refreshes release metadata during WordPress update checks, reducing stale-cache delays when a new TagRudder Tracker version is promoted.

= 1.6.21 =
* Improved: Admin panel visual refresh with cleaner inputs, textarea, select fields, rounded buttons, stronger spacing, and more professional card styling while preserving the existing TagRudder orange palette.
* Improved: Checkbox, radio, and toggle controls now have clearer states, better spacing, and selected-card highlighting for a more polished settings experience.
* Improved: Tracking mode, purchase trigger, identity/privacy, fraud, and lifecycle settings now present a more consistent and organized professional layout across tabs.

= 1.6.20 =
* Fix: Tracking → Features settings now save in the correct section, including Script Injection, Plugin Updates, purchase trigger, GTM excluded roles, and debug toggles.
* Fix: Section-based saving now preserves all non-active tabs while still allowing unchecked checkboxes inside the active tab to save correctly.

= 1.6.19 =
* Fix: Saving settings in one section (Setup, Tracking, Fraud Shield) no longer resets settings from other sections. Each form now only overwrites its own fields; fields from other sections are preserved from the previously saved state.

= 1.6.18 =
* Removed: Privacy acknowledgement checkbox for Raw hashing mode — selecting Raw now saves immediately without requiring an extra confirmation step.

= 1.6.17 =
* Fix: Saving GTM ID or Plugin API Key from the Setup tab no longer triggers the "Raw user data mode" privacy acknowledgement error. The hashing setting now correctly preserves its current value when not included in a partial form submission.

= 1.6.16 =
* Redesign: Fraud Shield rebuilt on order-limit approach — configurable max orders per N hours; identity signals (IP, browser fingerprint, phone, email, name, delivery address) stored as one-way hashes.
* New: Browser fingerprint collection (tagrudder-fingerprint.js) injects a hidden checkout field and persists a 365-day cookie for cross-session detection.
* New: Hard-block popup shown on checkout when an order is denied; no countdown or proceed button — order submission is prevented.
* New: Admin menu restructured as a top-level TagRudder entry with four sub-pages: Setup, Tracking, Fraud Shield, Docs & Info.
* Improved: Fraud Shield admin tab completely redesigned — check-card grid for identity signals, inline order-limit inputs, stat cards for history stats, cleaner IP denylist table.
* Improved: Admin CSS — section navigation bar, check-card grid, stat cards, danger-ghost button, improved spacing between checkboxes and radios.

= 1.6.15 =
* New: Fraud Shield — IP/CIDR denylist, per-IP order velocity scoring, heuristic risk signals (hosting proxy, guest+COD, first-time email), configurable soft/hard risk thresholds, checkout friction countdown popup, monitor-only mode, and a dedicated admin tab with CRUD denylist management.
* New: Incomplete Order Capture — fires checkout_started (server), checkout_abandoned (cron, hourly), and payment_failed (server) events for retargeting and funnel analysis.
* New: Custom Events Engine — theme and plugin developers can register named events via do_action('tagrudder_tracker_register_custom_events') and fire them with do_action('tagrudder_tracker_custom_event', $name, $payload).

= 1.6.14 =
* New: The Connection tab can now rotate the active TagRudder Plugin API key directly from WordPress admin, save the replacement encrypted locally, re-test validation, and record a heartbeat without exposing the raw replacement key to the browser.
* Security: Manager-side plugin rotation requires an authenticated plugin key plus verified WordPress site-domain binding before the old key is revoked and a replacement is issued.

= 1.6.13 =
* New: Cookie Keeper / custom-loader parity controls expose TagRudder-managed opaque loader paths plus configurable UID, click-ID, and UTM lifetimes, redundant storage, URL restoration, and first-party server refresh behavior.
* New: Customer Match scaffold adds a dedicated admin tab, consent-gated WooCommerce audience queue, SHA-256-only identifier upload, and manager-side `/plugin/customer-match/ingest` queueing so platform credentials stay out of WordPress.
* New: Optional WooCommerce Order Webhooks can emit selected order-status lifecycle events and GA4-style refund events server-to-server through TagRudder's authenticated event-log pipeline, with retry queue support and no arbitrary third-party webhook URL stored in WordPress.
* Security: Manager-issued plugin keys now receive warn-only domain-binding checks, config version/hash metadata, and visible admin warnings before any future enforcement mode is enabled.
* New: GTM Loader can now be consent-gated so the GTM script waits for granted analytics/ad consent, and selected logged-in WordPress roles can be excluded from GTM loader/noscript injection.
* New: WooCommerce DataLayer parity controls now add `view_item_list`, `select_item`, `remove_from_cart`, optional `cart_state`, richer item fields (`imageUrl`, list context, deeper categories, brand), and an optional browser-only event suffix for GTM conflict isolation.
* New: Diagnostics now keeps rolling validation/heartbeat history, HTTP status visibility, WP-Cron schedules, queue age/due counts, endpoint paths, HTTPS, HPOS, and Store API checkout checks for faster support triage.
* Privacy: Saving Raw user-data mode now requires an explicit acknowledgement; otherwise the plugin keeps SHA-256 hashing enabled by default.
* Security: API base URL validation now requires HTTPS and an approved TagRudder panel hostname, with a safe runtime fallback to the bundled default endpoint.
* Reliability: Retry queue flushing now honors `next_retry_at`, processes due items in bounded batches, and drops malformed/exhausted entries after the configured maximum attempts.

= 1.6.12 =
* Fix: Phone normalisation in `build_user_data` now strips all non-digit characters (including `+`) before SHA-256 hashing, matching Meta CAPI requirements and resolving a mismatch between `ph` / `phone_hashed` values produced by different code paths.
* Improvement: `build_purchase_payload` and `send_purchase_for_order` now emit flat billing and shipping address keys (`billing_city`, `billing_state`, `billing_zip`, `billing_country`, `shipping_*` equivalents) alongside effective top-level `city`, `state`, `zip`, `country`, `countryCode` fields so the sGTM Stape Facebook CAPI tag can read `eventData.city / state / zip / country` directly for `ct / st / zp / country` Event Match Quality fields.
* Improvement: Pre-hashed `ct`, `st`, `zp`, `country_hashed` variants are also emitted for direct CAPI paths; Stape's `isHashed()` guard prevents double-hashing.

= 1.6.11 =
* Fix: Deferred WooCommerce purchase snapshots now preserve storefront page URL, referrer, client IP, and client browser user-agent at checkout so later `completed` / `processing` replays no longer fall back to admin or webhook request metadata.
* Fix: Manager-side sGTM purchase relay now emits nested `user_data.fbp`, `user_data.fbc`, `user_data.client_ip_address`, and `user_data.client_user_agent` aliases while forcing `client_ip` / `user_agent` to prefer the real browser values, improving Facebook server-container tag mappings for test events and purchase dispatches.

= 1.6.10 =
* Fix: Deferred `processing` / `completed` WooCommerce purchase modes now snapshot the purchase payload and browser attribution signals at checkout order creation, preserving storefront `external_id`, `fbp`, `fbc`, and click IDs even when the final status change happens from wp-admin, cron, or a webhook.
* Fix: Manager-side sGTM purchase dispatch now hashes raw email / phone aliases from WooCommerce payloads before emitting Meta-compatible user-data params, so deferred server purchases do not leak unhashed `em` / `ph` values into the server container mapping layer.

= 1.6.9 =
* Fix: Meta `_fbp` values are now normalized to the canonical four-segment format before deferred WooCommerce purchases are stored or replayed, preventing Event Manager from silently dropping them as invalid user data.
* Fix: Manager `/events/log` now enriches inbound payloads before ledger creation, so request cookies can still backfill missing `_fbp` / `_fbc` signals when browser traffic sends them.
* Fix: Direct Meta CAPI payload building now normalizes `fbp` / `fbc` immediately before dispatch, matching the sGTM collect path.

= 1.6.8 =
* Fix: Completed/Processing purchase fallbacks now reuse the saved Thank You purchase snapshot when they dispatch server-side, so hashed user data, content aliases, and stored click signals survive deferred status changes.
* Fix: Deferred server-side WooCommerce purchases now carry richer customer address fields for downstream hashing and event-match enrichment.
* Fix: Manager-side sGTM purchase dispatch now forwards additional click IDs and explicit hashed user-data aliases for server-container tag mappings.

= 1.6.7 =
* Fix: Deferred GTM-mode WooCommerce purchases now rebuild their saved payload from the order when the Thank You snapshot is missing, so Processing/Completed triggers do not silently miss Purchase.
* Fix: Deferred GTM purchases only consume their browser replay after the manager confirms the same purchase already reached sGTM, preventing Completed/Processing orders from being marked tracked too early.
* Fix: Manager `/c/<cid>/events/log` responses now expose sGTM purchase dispatch status so the plugin can make reliable replay/fallback decisions for no-footer contexts.

= 1.6.6 =
* New: Manager `/plugin/validate` capability contract is consumed by the plugin admin UI.
* New: Install Health card with validate/heartbeat/release/WP-Cron/HTTPS status.
* New: Optional TagRudder-hosted update checks using `/plugin/info` and `/plugin/download`.
* Fix: Forwarding tab now shows a discontinued-state notice instead of surfacing broken destination-summary errors.
* Fix: Retry queue stores structured endpoint/status/error/next-retry metadata for diagnostics.

= 1.6.5 =
* Fix: Admin quick actions now test, refresh usage, and flush retry queue without broken selectors or stale UI state.
* Fix: Tracking modes are enforced consistently — Server-only emits no browser scripts, No-GTM no longer loads the GTM loader, and Browser Pixels obey their toggle.
* Fix: Server CAPI toggle now gates PHP mirrors and browser backup POSTs.
* Fix: Deferred WooCommerce purchases fall back to one server-side dispatch when Processing/Completed happens in admin, webhook, cron, or another no-footer context.
* Fix: Identity privacy toggles now control external_id/click-ID forwarding, and hashed mode no longer sends raw email/phone during identity stitching.
* New: Consent Mode bridge posts enabled consent updates to TagRudder with a scoped public write token.

= 1.6.4 =
* Fix: GTM mode no longer adds an extra plugin-side raw server Purchase on top of the web → sGTM purchase in immediate Thank You mode.
* Fix: Deferred Processing/Completed purchases in GTM mode now wait for the Thank You snapshot, preventing premature raw server duplicates when gateways mark orders paid before redirect.

= 1.6.3 =
* Fix: Server-side purchase events now fall back to the TagRudder panel domain when a legacy tracker subdomain does not proxy `/c/<cid>/events/log` yet.
* Fix: Future tracker nginx configs now expose `/c/<cid>/events/*` alongside `uid`, `store`, `inspect`, and `ledger` routes.

= 1.6.2 =
* Fix: Purchase trigger setting now saves correctly for Thank You, Processing, and Completed modes.
* Fix: Thank You page Purchase dataLayer event is no longer blocked by server-side status hooks.
* Fix: Deferred Processing/Completed purchase modes use separate server-side tracking guards to avoid duplicate or missing purchases.

= 1.5.3 =
* New: **Delayed Purchase event** — choose when the Purchase event fires: immediately on Thank You (default), only when the order moves to *Processing*, or only when the order moves to *Completed* (best for COD / manual fulfilment). Captures the full payload at checkout and replays it on the status transition, even if the cart/session is gone. Cancelled / refunded / failed orders are skipped automatically.

= 1.5.2 =
* Fix: Every server event now carries the actual visited page (`page_url` + `page_path`) instead of just the site root, so the dashboard "Page" column shows `/checkout`, `/product/xyz`, etc.
* Fix: `referrer` is auto-attached from `HTTP_REFERER` when the caller didn't set one.
* Fix: Internal admin / shop-manager browsing is excluded from server-side page_view to keep analytics clean.

= 1.5.1 =
* Fix: Plan & Usage card on Overview no longer shows `usage_fetch_failed` — corrected GET vs POST mismatch on `/plugin/usage`.
* New: Meta Pixel Advanced Matching — `fbq('init', PIXEL_ID, {em, ph, fn, ln, ct, st, zp, country, external_id})` is now emitted for logged-in users and WooCommerce checkout. Toggle in Identity & Privacy tab. Improves Event Match Quality (EMQ) score.

= 1.5.0 =
* New tabbed admin UI (Overview, Connection, Tracking Mode, Features, Forwarding, Identity & Privacy, Diagnostics, About) with brand styling.
* Plan & Usage card on Overview — pixel-plan customers now see their forwarded-events budget directly inside WordPress.
* API key is masked in the form and revealed on demand (rate-limited + audit-logged); stored AES-256 encrypted using site `AUTH_KEY`.
* `external_id` is now derived from the first-party `tr_uid` cookie for Meta CAPI / TikTok / Snap event matching.
* Honours `tr_<click_id>` cookies for the full Click-ID Extender set: fbclid, gclid, gbraid, wbraid, gad_source, msclkid, ttclid, twclid, dclid.
* Fixed Meta Pixel Helper "Content Name" — products now report human-readable names instead of bare IDs (`fbq` / `ttq` calls + server-side derivation).
* WooCommerce S2S coverage extended to view_item, view_cart, begin_checkout (in addition to add_to_cart, purchase).
* Pixel-mode and Server-only mode now also mirror tracker payloads to the server-side conversion ledger.
* Settings input is whitelisted (mode / GTM ID / `tr_pk_` key prefix / HTTPS endpoint) on every save.
* Declares WooCommerce HPOS (custom order tables) compatibility.
* AJAX actions for Test Connection / Flush Queue / Refresh Usage — no full page reloads.

= 1.0.0 =
* Initial public release.
