=== EcomSolveBD ===
Contributors: ecomsolvebd
Tags: woocommerce, analytics, attribution, tracking, utm
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
Stable tag: 1.0.43
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

First-party storefront tracking and WooCommerce events for EcomSolveBD — UTM, click IDs, sessions, and optional Google Analytics 4 Measurement ID.

== Description ==

EcomSolveBD connects your WordPress / WooCommerce store to [EcomSolveBD](https://ecomsolvebd.com) so you can attribute visits and orders with first-party collection.

**Features**

* Browser tracking for UTM parameters and ad click IDs (e.g. gclid, fbclid, ttclid)
* WooCommerce events when WooCommerce is active (view item, add to cart, purchase, and related hooks)
* Optional first-party tracking hostname (CNAME) to reduce ad-blocker impact
* Optional Google Analytics 4 Measurement ID (standard gtag.js automatic events only)
* Product feed URLs for EcomSolveBD catalog, Meta, TikTok, and Google Merchant Center

This plugin is a client for the EcomSolveBD service (SaaS). You need a free or paid EcomSolveBD account and a Tracking Merchant ID from your dashboard. All plugin code is free under GPLv2 or later; EcomSolveBD account features are provided by the service.

**External services**

After you save a valid Merchant ID, the plugin communicates with:

* `https://api.ecomsolvebd.com` — validate credentials, sync configuration, send tracking and order-related events
* Optionally your own tracking subdomain (CNAME to EcomSolveBD collect)
* Optionally `https://www.googletagmanager.com/gtag/js` when you enter a GA4 Measurement ID

See [EcomSolveBD privacy](https://ecomsolvebd.com/privacy) and the FAQ below.

== Installation ==

1. In WordPress go to **Plugins → Add New → Upload Plugin**.
2. Upload the `ecomsolvebd-tracker` zip from WordPress.org or your release package.
3. Activate **EcomSolveBD**.
4. Open **EcomSolveBD** in the admin menu, paste your Tracking Merchant ID from [EcomSolveBD → Integrations](https://ecomsolvebd.com/dashboard), and save.
5. (Optional) Configure first-party DNS and / or GA4 Measurement ID.

**Correct install path:** `wp-content/plugins/ecomsolvebd-tracker/ecomsolvebd-tracker.php`

If WordPress shows **“Plugin file does not exist”**, delete any broken `ecomsolvebd-tracker*` folders under `wp-content/plugins/` (SFTP), remove any legacy `fcommerce-tracker` folder, then upload a zip built with forward-slash paths (not Windows Explorer “Send to compressed folder”).

== Frequently Asked Questions ==

= Does this require WooCommerce? =

No. Storefront tracking works on normal pages. WooCommerce-specific scripts load only when WooCommerce is active.

= Does this require an EcomSolveBD account? =

Yes. Create an account at [ecomsolvebd.com](https://ecomsolvebd.com), connect your store, and copy the Tracking Merchant ID into the plugin settings. Saving a valid Merchant ID is how you authorize the plugin to send data to EcomSolveBD.

= What data is sent? =

Depending on configuration: page and session identifiers, UTM / click IDs, device and referrer context, and (with WooCommerce) order and cart-related event payloads used for attribution and reporting in your EcomSolveBD dashboard. See the service privacy policy.

= Does the plugin load Google Analytics? =

Only if you enter a GA4 Measurement ID on the plugin’s GA4 settings page. Then the standard Google tag (gtag.js) is loaded from Google for automatic events. Leave the field empty to disable GA4.

= Is there a trial lock or paid unlock inside the plugin? =

No. All plugin features that ship in this package are available once connected. Premium capabilities live on the EcomSolveBD service, not behind a locked local feature.

== Privacy ==

This plugin does not phone home until an administrator configures a Merchant ID (and optionally GA4). Merchants are responsible for disclosing storefront analytics and advertising attribution to their visitors (cookie / privacy notices, consent tools) as required by local law. Visitor identifiers may be stored in first-party cookies for attribution continuity.

Privacy policy: https://ecomsolvebd.com/privacy  
Terms: https://ecomsolvebd.com/terms

== Changelog ==

= 1.0.43 =
* WP admin: remove first-party DNS table / parity copy — verify only in EcomSolveBD Integrations; plugin shows status + link.

= 1.0.42 =
* First-party DNS Verify moved to EcomSolveBD Integrations (Woo) — plugin syncs status from SaaS like Shopify/Laravel/Next.

= 1.0.41 =
* DNS Verify: Cloudflare DoH + SaaS CNAME check when hosting dns_get_record misses a valid CNAME (common on managed WP).

= 1.0.40 =
* On Verify: call SaaS to auto-create Cloudflare Custom Hostname (no manual Add per merchant), then require HTTPS before activating subdomain ingest.

= 1.0.39 =
* Persist DNS verify to settings immediately (survives Clear Cache). Require HTTPS health on the tracking host before activating subdomain ingest (CNAME-only no longer switches off store_proxy onto a dead edge). Save keeps a verified host if DNS re-check flakes.

= 1.0.38 =
* Restore checkout/cart auto page_view (same as before): page_view + begin_checkout/view_cart. Keep 1.0.36 storm fixes (one HTTP per event).

= 1.0.37 =
* Checkout/cart: skip auto page_view + clarity sync so only begin_checkout / view_cart fire (keeps form events). Stops duplicate master-ingest.

= 1.0.36 =
* Fix multi-POST storms: each track() sends only that event (no outbox backlog replay); clarity sync once/session; cache attribution-config 12h.

= 1.0.35 =
* Fix wrong visitor geo on store_proxy: map CF visitor IP/country to X-ESB-* (raw cf-* still not forwarded).
* Harden view_item to once per PDP page (stops 429 storms with page_view/outbox).

= 1.0.34 =
* Fix checkout hang: stop `esb-wc-bridge` from retry-storming `master-ingest` on HTTP 429 (was starving Woo AJAX).
* Tracker outbox: long backoff + drain pause on rate limit; stable client_event_id for begin_checkout/view_cart.

= 1.0.27 =
* Settings: clearer Merchant ID help; hide connection banner, server-side capture toggle, and console debug from UI.
* GA4: cleaner copy; keep Measurement ID guide link.
* WordPress.org polish: plugin-only notices, merchant-safe connection errors, exclude internal docs from zip.

= 1.0.26 =
* Plugins screen: Settings link next to Deactivate.

= 1.0.25 =
* Admin UI: English-only strings (removed hardcoded Bengali).

= 1.0.24 =
* Product Feed: restore EcomSolveBD catalog card (`/feed/products.xml`).

= 1.0.23 =
* Plugin display name: EcomSolveBD (removed “Tracker”).
* Admin menu icon: white mark matching WordPress menu style.

= 1.0.22 =
* WordPress.org readiness: LICENSE, readme Description / Privacy / external services disclosure.
* Full EcomSolveBD branding (removed leftover F-Commerce admin copy).
* Packaging guidance: keep slug `ecomsolvebd-tracker` stable; ship POSIX-path zips only.

= 1.0.21 =
* Admin menu brand icon; menu position above WooCommerce.
* Link to Measurement ID & API Secret guide from the GA4 settings page.

= 1.0.20 =
* First-party tracking settings UI aligned with EcomSolveBD dashboard patterns.

= 1.0.19 =
* First-party Auto mode: browser collect uses same-origin store REST proxy until DNS is verified, then switches to the custom tracking subdomain.

= 1.0.18 =
* Product Feed admin: Facebook / TikTok / Google feed URLs.

= 1.0.17 =
* Product feeds: `/feed/products.xml`, `/feed/facebook.xml`, `/feed/tiktok.xml`, `/feed/google.xml`.

= 1.0.16 =
* GA4 Measurement ID loads standard gtag.js only (automatic events).

= 1.0.15 =
* Server-side landing capture for click IDs / UTM before theme and pixels run.

= 1.0.1 =
* Rename from legacy folder to `ecomsolvebd-tracker`; migrate `fct_*` options to `esb_*`.

= 1.0.0 =
* Rebrand to EcomSolveBD Tracker.

== Upgrade Notice ==

= 1.0.23 =
Display name EcomSolveBD + white admin menu icon. Same folder slug — safe to overwrite-update.

= 1.0.22 =
Branding and WordPress.org documentation updates. Keep the same plugin folder name when updating — do not rename `ecomsolvebd-tracker`.
