=== Modovisa Analytics ===
Contributors: modovisa
Tags: analytics, real-time, visitor tracking, conversions, privacy
Requires at least: 6.0
Tested up to: 7.0.2
Requires PHP: 7.4
Stable tag: 1.0.9
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Real-time visitor tracking for WordPress. Paste your Modovisa tracking token and load a lightweight first-party script on the front end only.

== Description ==

**Modovisa Analytics** adds a small settings screen where you paste your **Tracking token** and turn tracking on. The plugin then loads the Modovisa tracker on your **public site only** — never in `wp-admin`.

[Modovisa](https://modovisa.com/integrations/wordpress) is privacy-friendly, first-party analytics focused on live visitors, page journeys, and campaign attribution. This plugin only installs the script; reporting happens in your Modovisa dashboard.

= Features =

* Loads once per page in the document head (optional `defer`).
* Does **not** load in the WordPress admin.
* Uses standard WordPress script APIs (`wp_register_script` / `wp_enqueue_script`).
* Compatible with common optimizers (LiteSpeed Cache, Autoptimize, WP Rocket) via exclude hints.
* **Multisite:** set a network token once under Network Admin; each site can use network settings or its own token.

= How-to video =

Short setup walkthrough:

https://www.youtube.com/watch?v=olSW5JawjzE

= External services =

This plugin connects your WordPress site to the **Modovisa Analytics** service to record front-end page views and related events.

**Domains**

* `https://cdn.modovisa.com/modovisa.min.js` — tracker script loaded when tracking is enabled.
* `https://modovisa.com` and Modovisa API/CDN subdomains — receive analytics events from that script.

**Data sent (front end only)**

* Page URL/path, referrer (if available), user agent, and basic device/viewport info.
* Your **Tracking token**, so events attach to the correct Modovisa site.
* Pseudonymous visit/session identifiers (for example first-party cookies) for returning visits.

The plugin does **not** load in `wp-admin` and does not send WordPress user emails, passwords, or other WP user PII.

**Consent**

If you use a consent banner, load the Modovisa script only after consent is granted.

**Policies**

* Terms: https://modovisa.com/legal/terms-and-conditions
* Privacy: https://modovisa.com/legal/privacy-policy

== Installation ==

= From WordPress.org =

1. Install and activate **Modovisa Analytics**.
2. Go to **Settings → Modovisa Analytics**.
3. Paste your Tracking token from [modovisa.com](https://modovisa.com), enable tracking, and save.
4. Open your site front end and confirm you appear in the Modovisa live view.

= Multisite =

1. Network activate the plugin (optional) or activate per site.
2. As a network admin: **Network Admin → Settings → Modovisa Analytics** to set a network token.
3. On each site: **Settings → Modovisa Analytics** and choose **Network settings** or **This site**.

= Manual ZIP upload =

1. Upload and activate the plugin.
2. Configure the token under **Settings → Modovisa Analytics** as above.

== Frequently Asked Questions ==

= Does it work with caching or CDN plugins? =

Yes. The tracker is a normal front-end script. LiteSpeed Cache, Autoptimize, and WP Rocket are nudged not to combine or delay it. If another optimizer still delays scripts, exclude `modovisa.min.js` / `cdn.modovisa.com`.

= Will it track wp-admin? =

No. The script is only enqueued on the public front end.

= Can I load the script with defer? =

Yes. There is a **Defer** toggle on the settings page (and on the network settings page for Multisite).

= How do I stop tracking? =

Turn **Enable tracking** off, or deactivate the plugin.

= Does Multisite need a token on every site? =

No. You can set one network token and let sites use **Network settings**, or override per site with **This site**.

= Where do I get a Tracking token? =

Create a Modovisa account, add your site, and copy the token from the dashboard (Installation / Tracking setup). See https://modovisa.com/integrations/wordpress

= Consent and privacy? =

Use your consent tool so the script loads only after consent. See Modovisa’s privacy policy linked below.

== Privacy ==

This plugin connects your site to **Modovisa Analytics** to measure visits and conversions. On front-end page loads, the script from `https://cdn.modovisa.com/modovisa.min.js` sends event data to Modovisa. The payload typically includes page URL, referrer (if available), user agent, and pseudonymous visit/session identifiers. Admin screens and WordPress user PII are not sent by this plugin.

You need an active Modovisa account and Tracking token. Enabling tracking means analytics data is sent to Modovisa under:

* Terms: https://modovisa.com/legal/terms-and-conditions
* Privacy: https://modovisa.com/legal/privacy-policy

== Screenshots ==

1. Settings screen with Tracking token and enable toggle.
2. Example Modovisa script tag in the page head.

== Changelog ==

= 1.0.9 =
* WooCommerce: completed orders report their exact total, currency and order number, read from the order itself. Sales and revenue appear in Modovisa without any extra code, and refreshing the order-received page does not report a second sale.
* Cart, checkout and product pages send nothing extra — Modovisa's tracking script recognises those pages on its own — so your event count is unchanged.
* No effect on sites without WooCommerce.

= 1.0.8 =
* Multisite site settings: Network settings / This site controls show a clear selected state.
* When Network settings is selected, site-level Enable / token / defer fields are hidden; front-end enable still follows the network admin.

= 1.0.7 =
* Multisite: network administrators can set a network tracking token under Network Admin → Settings → Modovisa Analytics.
* Each site can choose Network settings or This site. Single-site installs are unchanged.
* Legacy multisite sites that already have a token keep using the site token until they switch the new toggle.

= 1.0.6 =
* LiteSpeed Cache compatibility (`data-no-optimize`, `data-no-defer`, and LiteSpeed JS exclude filters).
* Fixed duplicate `id` on the script tag; only the plugin id is printed.

= 1.0.5 =
* Tested with WordPress 7.0.1; metadata only.

= 1.0.4 =
* Tested with WordPress 6.9.4; metadata only.

= 1.0.3 =
* Tested with WordPress 6.9; no code changes required.

= 1.0.2 =
* Switched to `wp_enqueue_scripts` with proper attributes per review feedback.
* Readme: External services section (domains, data flow, policy links).
* Explicit script version on register (avoids MissingVersion warnings).

= 1.0.1 =
* Initial release.

== Upgrade Notice ==

= 1.0.9 =
WooCommerce stores now report completed orders with their exact total, so revenue is correct without extra setup.

= 1.0.8 =
Clearer Multisite site settings UI when using network vs this-site configuration.

= 1.0.7 =
Adds Multisite network token support. Optional for single-site installs.

= 1.0.6 =
Recommended if you run LiteSpeed Cache so delayed/combined JS cannot drop visits.
