=== SimpliRoot - Lead Capture & Call Tracking ===
Contributors: simpliteca
Tags: leads, crm, contact form 7, call tracking, attribution
Requires at least: 5.6
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 2.4.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Send Contact Form 7 submissions and tracked phone calls to your SimpliRoot CRM — server-side, with full ad-platform attribution.

== Description ==

SimpliRoot Lead Capture connects your WordPress site to your **SimpliRoot** account (https://simpliroot.com). It captures leads from your contact forms and phone calls and forwards them to your project's CRM, together with the marketing attribution (UTM tags, ad-platform click-ids and referrer) needed to know which campaign produced each lead.

Capture happens **server-side**, so it works even when the visitor declines cookies, blocks JavaScript or uses an ad-blocker, and without depending on Google Tag Manager.

= What it does =

* **Form leads (Contact Form 7).** When a form is submitted, the plugin sends the submitted fields, the page URL, and any consent (acceptance) checkboxes to your SimpliRoot CRM.
* **Call tracking (DNI).** Optionally loads SimpliRoot's dynamic-number-insertion script so phone calls are tied to the campaign that drove the visit.
* **Full attribution.** Recognizes UTM parameters, referrer, and 16 ad-platform click-ids automatically: Google (gclid/gbraid/wbraid), Microsoft, Meta, TikTok, LinkedIn, X, Pinterest, Reddit, Snapchat, Yandex, Taboola, Outbrain.
* **Token-only setup.** Paste your project token, pick what to track. A "Test connection" and "Send test lead" button confirm everything works.

= Requirements =

* A **SimpliRoot account** and a project token (free to obtain at https://simpliroot.com).
* For form capture: the **Contact Form 7** plugin.

== External services ==

This plugin is a client for the **SimpliRoot** service and **requires an active SimpliRoot account** to function. It is not usable on its own. It communicates with SimpliRoot's API at **https://app.simpliroot.com**.

The following data is transmitted to SimpliRoot:

1. **When you save settings or use the "Test connection" button** (admin only): your project token is sent to `https://app.simpliroot.com/api/leads/config/{token}` to resolve and display the connected project name.

2. **When a visitor submits a Contact Form 7 form** (if form capture is enabled): the plugin sends to `https://app.simpliroot.com/api/leads/web/{token}` the data the visitor entered (e.g. name, email, phone and any other form fields), the state of consent checkboxes, the page URL, the referrer, the visitor's IP address and browser user-agent string, and any UTM parameters / ad-platform click-ids present in the visit. This is personal data and is sent so it can be stored as a lead in your CRM.

3. **When call tracking is enabled**: the plugin loads the script `https://app.simpliroot.com/js/dni-router.js` on your pages, which swaps displayed phone numbers and reports call attribution to SimpliRoot.

4. **When you click "Send test lead"** (admin only): a sample lead is sent to the same lead endpoint so you can verify the connection.

Your use of the SimpliRoot service is governed by its terms and privacy policy:

* Terms of Service: https://simpliroot.com/terms/
* Privacy Policy: https://simpliroot.com/privacy/

As the site owner you are responsible for disclosing this data processing to your visitors and for obtaining any consent required in your jurisdiction.

== Installation ==

1. Install and activate the plugin.
2. In your WordPress admin, open the **SimpliRoot** menu.
3. Paste your **Project token** (SimpliRoot → your project → *Calls* tab → *Project token*).
4. Choose what to track: **Form leads** (requires Contact Form 7) and/or **Call tracking**.
5. Click **Save changes**, then **Test connection** and **Send test lead** to confirm leads arrive in your CRM.

If you previously added the DNI tag through Google Tag Manager, remove it after enabling call tracking here to avoid loading it twice.

== Frequently Asked Questions ==

= Do I need a SimpliRoot account? =

Yes. This plugin sends your leads to SimpliRoot and requires a project token from a SimpliRoot account.

= Does it work without cookie consent? =

Yes. Form and call data are captured server-side, so capture does not depend on the visitor accepting cookies. You remain responsible for disclosing this processing to visitors.

= Which forms are supported? =

Contact Form 7. The plugin reads each form's fields and consent (acceptance) tags automatically.

= Where do my leads go? =

To the CRM of the project the token belongs to, inside your SimpliRoot account at https://app.simpliroot.com.

== Screenshots ==

1. The SimpliRoot settings screen — connected to a project, with Contact Form 7 lead capture and call tracking enabled.
2. Testing the connection — the plugin resolves your project token and confirms which CRM the leads will be sent to.

== Changelog ==

= 2.4.0 =
* All scripts now enqueued via wp_enqueue_script / wp_add_inline_script (no inline script tags).
* Attribution cookie data is sanitized per value before use.
* Single-line plugin description; display name updated.

= 2.3.0 =
* Prepared for the WordPress.org Plugin Directory: added readme, full external-services disclosure, license file.
* Hardening: unslash/sanitize all superglobal input before use.

= 2.2.0 =
* Capture all Contact Form 7 fields, the exact page URL, and consent checkbox states.
* 16 ad-platform click-ids plus UTM and referrer attribution.
* Settings page with Test connection and Send test lead.

== Upgrade Notice ==

= 2.4.0 =
Scripts are now enqueued the WordPress way and attribution data is sanitized per value.
