=== S2S Conversions ===
Contributors: thijsjoostenda
Tags: google analytics, ga4, server-side tracking, woocommerce, conversion tracking
Requires at least: 6.0
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.26
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Server-side GA4 tracking via the Measurement Protocol. Adblocker-proof, GDPR-ready, and free forever.

== Description ==

**S2S Conversions** sends purchase and lead events directly from your server to Google Analytics 4 via the Measurement Protocol — bypassing ad blockers, browser restrictions, and cookie limitations.

Unlike client-side tracking via Google Tag Manager, server-side events are never blocked and always arrive — even when a visitor uses an ad blocker, Safari ITP, or closes the browser before the thank-you page loads.

= Key Features =

* **GA4 purchase tracking** — sends complete purchase data including items, revenue, tax and shipping
* **GA4 lead tracking** — tracks form submissions as generate_lead events
* **Session ID tracking** — correctly attributes conversions to the right channel (Google Ads, Meta, Organic) instead of Unassigned/Direct
* **Form integrations** — supports Contact Form 7, WPForms, Gravity Forms, and Elementor Pro Forms
* **10 cookie consent tools** — works with Cookiebot, Complianz, OneTrust, Real Cookie Banner, Borlabs, iubenda, Moove GDPR, CookieScript, WP Cookie Notice, and a custom banner
* **Adblocker-proof** — events are sent server-side, never blocked
* **GDPR-ready** — GA4 events contain no personally identifiable information; consent is respected before sending any data
* **Debug log viewer** — built-in log viewer in the settings page for easy troubleshooting
* **WooCommerce HPOS compatible** — fully supports High Performance Order Storage

= How It Works =

1. When a customer completes a checkout, the plugin captures the GA4 session data (client_id, session_id) before the payment redirect
2. After payment, the plugin sends the purchase event server-side via the GA4 Measurement Protocol
3. Because the session data was captured before the redirect, the conversion is correctly attributed to the original traffic source

= Pro Version =

The free version tracks GA4 only. Upgrade to **S2S Conversions Pro** at [s2s-plugin.tj-da.com](https://s2s-plugin.tj-da.com) for:

* **Google Ads** — server-side click conversion upload + enhanced conversions
* **Meta CAPI** — Facebook/Instagram Conversions API with email and phone hashing
* **LinkedIn CAPI** — LinkedIn Conversions API
* **Data Manager API** — dual-write to Google's Data Manager API
* **Lead conversion slots** — map specific forms to specific Google Ads conversion actions
* **License management** — secure per-domain licensing

= Supported Consent Tools =

* Cookiebot
* Complianz
* OneTrust
* Real Cookie Banner v3
* Borlabs Cookie
* iubenda
* Moove GDPR
* CookieScript
* WP Cookie Notice
* Custom banner (cookieConsent cookie)

= External Services =

This plugin sends data to the following external services:

* **Google Analytics** (analytics.google.com) — to send purchase and lead events via the Measurement Protocol. [Google Privacy Policy](https://policies.google.com/privacy)
* **s2s-plugin.tj-da.com** — to verify DPA (Data Processing Agreement) acceptance. No personal data is sent; only a domain verification request is made. [Privacy Policy](https://s2s-plugin.tj-da.com/privacy.php)

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/` or install via the WordPress plugin screen
2. Activate the plugin through the **Plugins** screen in WordPress
3. Go to **Settings → S2S Conversions**
4. Accept the Data Processing Agreement
5. Enter your **GA4 Measurement ID** and **API Secret** (find these in GA4 → Admin → Data Streams → Measurement Protocol API Secrets)
6. Save settings

= Getting your GA4 API Secret =

1. Open [Google Analytics](https://analytics.google.com)
2. Go to **Admin → Data Streams → click your web stream**
3. Scroll to **Measurement Protocol API secrets → Create**
4. Copy the secret and paste it into the plugin settings

== Frequently Asked Questions ==

= Does this replace my Google Tag Manager setup? =

No — it complements it. Keep your existing GTM setup for pageviews, events and other tracking. This plugin adds a server-side layer specifically for purchase and lead conversions that are often lost due to ad blockers or payment redirects.

= Will this work without WooCommerce? =

Yes! The plugin works without WooCommerce for lead/form tracking. WooCommerce is only required for purchase tracking.

= Does this work with Mollie, iDEAL or other payment providers that redirect away from the site? =

Yes — this is one of the main benefits. The plugin captures all session data before the payment redirect. Even when a customer is redirected to an external payment page and back, the conversion is correctly attributed.

= Is this GDPR compliant? =

Yes. GA4 events contain no personally identifiable information — only a pseudonymous client_id and session_id. The plugin respects your visitor's consent settings and only fires after the appropriate consent has been given (configurable per consent tool).

= What consent tools are supported? =

Cookiebot, Complianz, OneTrust, Real Cookie Banner v3, Borlabs Cookie, iubenda, Moove GDPR, CookieScript, WP Cookie Notice, and a custom cookie banner.

= What is Action Scheduler and do I need it? =

Action Scheduler is used to process conversions asynchronously (in the background). It comes bundled with WooCommerce. If you don't have WooCommerce, install the free [Action Scheduler](https://wordpress.org/plugins/action-scheduler/) plugin by Automattic for best results. Without it, the plugin falls back to WordPress cron, which is less reliable.

= Where can I find the debug log? =

Go to **Settings → S2S Conversions** and scroll to the bottom. The debug log viewer shows the last 200 lines of the log file in real time.

== Screenshots ==

1. Settings page — GA4 configuration
2. Debug log viewer — real-time event log
3. Consent tool selection

== Additional Information ==

S2S Conversions was built out of frustration with the growing gap between what web analytics reports and what actually happens. Ad blockers, iOS tracking prevention, and payment redirects cause a significant portion of conversions to go unrecorded — meaning marketers make decisions based on incomplete data.

The solution is straightforward: send conversion events from the server instead of the browser. The server always fires. It doesn't get blocked. It doesn't lose session data during a payment redirect. And because it captures the GA4 session ID before any redirect happens, conversions are attributed to the right channel — Google Ads, Meta, Organic — instead of showing up as Unassigned or Direct.

This free version focuses entirely on GA4 and handles the most common scenarios: WooCommerce purchases and form submissions. It works alongside your existing Google Tag Manager setup, not instead of it.

If you need server-side tracking for Google Ads, Meta CAPI or LinkedIn CAPI, the Pro version at [s2s-plugin.tj-da.com](https://s2s-plugin.tj-da.com) covers those platforms with the same approach.

Built by [Thijs Joosten Digital Acquisition](https://tj-da.com) — a digital marketing specialist focused on measurement, attribution and conversion optimisation.

== Changelog ==

= 1.0.26 =
* Improved: consent detection hardening across all supported consent tools
* Improved: session capture reliability during payment redirects
* Fixed: various stability and compatibility fixes since 1.0.17

= 1.0.17 =
* Added: form tracking for Contact Form 7, WPForms, Gravity Forms, Elementor Pro Forms
* Added: session_id tracking for correct channel attribution in GA4
* Added: debug log viewer in settings page
* Added: support for all 10 major cookie consent tools
* Added: Action Scheduler notice when not installed
* Improved: purchase payload now includes items, shipping and tax
* Fixed: lead events now correctly queued via Action Scheduler on non-WooCommerce sites

= 1.0.0 =
* Initial release — GA4 server-side purchase tracking via Measurement Protocol

== Upgrade Notice ==

= 1.0.26 =
Stability and consent detection improvements. Recommended for all users.

= 1.0.17 =
Major update: adds form tracking, session ID attribution, debug log viewer and full consent tool support. Recommended for all users.
