=== TrackSharp: Server-Side GA4 Tracking + Attribution Audit for WooCommerce ===
Contributors: kayavanvliet
Tags: woocommerce, ga4, server-side tracking, google ads, facebook pixel
Requires at least: 6.1
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.3.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Secure server-side GA4 tracking for WooCommerce + a built-in Audit Dashboard to detect Google Ads & Meta attribution risks.

== Description ==

**Improve purchase conversion tracking accuracy for WooCommerce with native server-side tracking.**

Browser-based tracking is blocked by modern privacy settings (ITP), ad blockers, and consent choices. This leads to missing purchase conversions in GA4 and incomplete ad reporting.

**TrackSharp** adds a reliable, first-party server-side tracking layer. It ensures your most important event — **Purchase** — is recorded in GA4 even when browser tags fail.

No GTM server container. No Google Cloud costs. No complex coding.

> “We previously used Google Tag Manager, but browser blocking still caused us to miss up to 40% of our conversions. With TrackSharp, our data is finally 100% accurate without us needing to change a thing.”
>
> **Jordi** — Online Marketer at Hbeds.nl

= What Problem We Solve =

Most store owners don't know *how much* data they are losing. Setting up server-side tracking usually requires complex Google Tag Manager (GTM) containers, monthly cloud hosting fees (Stape/Google Cloud), and developer time.

**TrackSharp removes that complexity and cost.**
It runs directly on your WordPress server as a native plugin. You can complete the setup in 5 minutes and immediately start auditing your data loss and fixing GA4 tracking.

= Features & Capabilities =

**1. Instant Attribution Audit (Free)**
Unique to TrackSharp: we don't just track, we *diagnose*. The dashboard uses your real historical order data to highlight risks:
* **Google Ads Blind Spots:** See how many orders have Google Click IDs (gclid) that browser tracking might have missed.
* **Meta Pixel Health:** Monitor if your browser Pixel is firing correctly or being blocked.

**2. Reliable GA4 Server-Side Tracking**
Sends purchase events via the Measurement Protocol directly from your server. This bypasses ad blockers and iOS restrictions to close the gap between WooCommerce orders and Analytics reports.

**3. Native WooCommerce Integration**
Unlike generic GTM solutions, TrackSharp is purpose-built for WooCommerce. It listens to internal order hooks to ensure data accuracy.

= Supported WooCommerce Events =

TrackSharp tracks the complete shopping journey server-side (GA4) to ensure full funnel visibility:

* **Shopper Activity:** `view_item` (product view), `add_to_cart`, `view_cart`
* **Checkout Flow:** `begin_checkout`, `add_payment_info`
* **Conversion:** `purchase` (Order Completed)

*Note: Non-purchase events are sent via the first-party collector endpoint included in the free version.*

= Best Fit For Which Stores? =

* **Stores running Paid Ads:** If you spend budget on Google Ads or Meta (Facebook/Instagram) and suspect your ROAS is inaccurate due to tracking loss.
* **Cost-Conscious Owners:** Stores that want reliable Server-Side tracking without paying €20-€100/month for external hosting (like Stape or Google Cloud).
* **Agencies & Freelancers:** Professionals looking for a "set-and-forget" solution for clients that doesn't require maintaining complex GTM server containers.
* **Non-Technical Founders:** Anyone who wants to fix their data accuracy in 5 minutes without writing code or hiring a developer.

= Pro Version: Advanced Attribution =

For stores running paid ads on Google or Meta, TrackSharp Pro adds the missing attribution layer:

* **Google Ads Attribution:** Captures attribution parameters server-side so conversions are credited to the right campaign.
* **Meta Conversions API (CAPI):** Full server-side backup for the Facebook Pixel.
* **Enhanced Conversions:** Sends hashed user data (email/phone) to improve match rates on both platforms.
* **Priority Support:** Direct access to the developers via email.

== How It Works ==

1.  **Install:** Activate the plugin on your WordPress site.
2.  **Connect:** Use the Setup Wizard to link your GA4 Measurement ID.
3.  **Audit:** Check the Dashboard to see your "Revenue Audit" and potential data loss.
4.  **Relax:** TrackSharp now runs in the background, securing your data.

== Installation ==

1.  Install and activate the plugin.
2.  Go to **TrackSharp → Setup Wizard**.
3.  Enter your GA4 Measurement ID and Measurement Protocol API Secret.
4.  (Recommended) Use a CMP that integrates with the WP Consent API.
5.  Place a test order and review **TrackSharp → Events**.

== Frequently Asked Questions ==

= Does this replace my GA4 browser tags? =
No. TrackSharp adds server-side tracking as a safety net. If you use GTM for browser tags, TrackSharp handles the deduplication (using `event_id`) to prevent double counting.

= Do I need a GTM server container (Stape / Google Cloud)? =
No! That is the main benefit of TrackSharp. It runs directly on your WordPress server. You save €20-€100/month on external server hosting costs compared to container-based solutions like Conversios or Stape.

= Is it GDPR compliant? =
TrackSharp integrates with the WP Consent API. It only sends data when the appropriate consent (Statistics/Marketing) is granted. If no CMP is found, you can configure the fallback behavior.

== Screenshots ==

1.  **Dashboard** - Instantly see "Untracked Google Ads Revenue" and "Pixel Gaps".
2.  **Events Log** - Inspect individual API calls and status indicators.
3.  **Settings** - GA4 credentials and consent configuration.
4.  **Setup Wizard** - Guided 5-minute setup.

== Changelog ==

= 1.3.2 =
* New: Browser-first + server fallback is now the recommended GA4 reporting mode.
* New: First-party GA4 attribution context is captured for server fallback events.
* Improved: Server-side GA4 Measurement Protocol events can replay campaign details to reduce "(not set)" attribution.
* Improved: Server fallback purchases now preserve the original browser event timestamp and documented IP/User-Agent context.

= 1.3.1 =
* Improved: Events log now shows friendly browser names (e.g. "Chrome 131", "Edge 145") instead of raw User-Agent strings.
* Fixed: Consent-denied purchases are now visible in the events log instead of silently missing.

= 1.3.0 =
* Fixed: Trial users can now upgrade to paid from the in-dashboard pricing page.
* Fixed: All upgrade buttons (pricing page, account page, sidebar) link to the correct checkout.
* New: Expired trial notice with upgrade prompt on TrackSharp admin pages.
* New: Purchase link on the license activation screen for blocked users.
* Improved: Currency automatically set based on locale (EUR for Dutch, USD for international).
* Improved: Pricing page now works in-dashboard for all locales.

= 1.2.9 =
* New: 14-day free trial for Pro features (no credit card required).

= 1.2.8 =
* New: Referral preservation to improve GA4 attribution accuracy.
* New: All e-commerce events now sent via browser when reporting_first mode is enabled.
* Improved: Browser-side event logging for all events.
* Improved: client_id handling across events.

= 1.2.7 =
* New: GA4 Purchase Mode setting (server-only vs browser + server backup; Google tag required for best GA4 attribution).

= 1.2.6 =
* New: "Attribution Audit" cards on the Dashboard to highlight tracking risks using real site data.

= 1.2.5 =
* Added GA4 comparison mode to send server purchases as purchase_sst.
* Increased log retention to 180 days.

= 1.2.4 =
* Added setting to measure revenue excluding VAT/tax.

= 1.2.3 =
* Dutch sites: Upgrade button opens https://tracksharp.nl

= 1.2.2 =
* Initial WordPress.org release.

== Upgrade Notice ==

= 1.3.2 =
Improved GA4 attribution for server-side-only and fallback purchases with first-party campaign context replay.

= 1.3.1 =
Friendly browser names in events log. Consent-denied purchases now logged for auditing.

= 1.3.0 =
Fixed trial-to-paid upgrade flow. Upgrade buttons now work correctly during and after trial.

= 1.2.9 =
New: 14-day free trial for Pro features.

= 1.2.8 =
Improved GA4 attribution with referral preservation and enhanced browser-side e-commerce tracking

= 1.2.7 =
Added Browser + server fallback mode for GA4 attribution improvement

= 1.2.6 =
New Dashboard cards show Google Ads & Meta attribution risks..

= 1.2.5 =
GA4 comparison mode (purchase_sst) + improved default retention.

= 1.2.4 =
Added a setting to measure revenue excluding VAT/tax.

= 1.2.3 =
Dutch sites: Upgrade button opens https://tracksharp.nl/#prijzen.

= 1.2.2 =
Initial WordPress.org release.

== Third Party Services ==

= Google Analytics 4 (Measurement Protocol) =
TrackSharp sends server-side events to Google Analytics 4 when configured.
* Service: https://www.google-analytics.com
* Terms: https://policies.google.com/terms
* Privacy Policy: https://policies.google.com/privacy

= Meta (Facebook) Conversions API (Pro only) =
When using TrackSharp Pro, purchase events can be sent to Meta via the Conversions API.
* Service: https://graph.facebook.com
* Terms: https://www.facebook.com/terms.php
* Privacy Policy: https://www.facebook.com/privacy/policy

= Freemius =
TrackSharp uses Freemius for optional upgrades, licensing, and updates.
* Service: https://freemius.com
* Terms: https://freemius.com/terms/
* Privacy Policy: https://freemius.com/privacy/
