=== OneLence Connect ===
Contributors: crelora
Tags: analytics, attribution, woocommerce, tracking, consent
Requires at least: 5.8
Tested up to: 6.6
Requires PHP: 7.4
Stable tag: 1.1.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

OneLence Connect brings one-click server-side attribution tracking to WordPress and WooCommerce.

== Description ==

OneLence Connect is a one-click integration alternative to direct Mark SDK setup.
It provides:

* Server-side event tracking
* WooCommerce conversion tracking with retry handling
* CMP-aware consent behavior for visitor and UTM cookies
* Hybrid mode with deduplicated pageview behavior
* Secret-key-only server ingestion for trusted S2S traffic
* Diagnostics and debug tooling in wp-admin

== Installation ==

1. Upload the `onelence-connect` folder to `/wp-content/plugins/`.
2. Activate **OneLence Connect** from the WordPress Plugins screen.
3. Open **OneLence** in wp-admin.
4. Connect your OneLence account or paste API keys manually.
5. Save settings and run **Test Connection**.

== Frequently Asked Questions ==

= What is the difference between Relaxed and Strict consent mode? =
Relaxed mode allows server-side pageview collection while deferring cookie writes and JS loading until consent.
Strict mode blocks both server and JS tracking until consent is granted.

= Does this work without WooCommerce? =
Yes. Page view and event tracking work on any WordPress site.

= How are duplicate page views avoided in Hybrid mode? =
Hybrid mode uses JS pageview autocapture while PHP pageview emission is skipped.

= What happens when conversion delivery fails? =
The plugin does not mark the order as tracked until a successful response is received. Failed sends are retried.

= Which key is used for server-side requests? =
Server-driven events and conversions use the secret key only.
Publishable keys are reserved for the browser SDK.

= How can I validate site/origin configuration before launch? =
Use **Test Connection** in the Dashboard tab. The response includes preflight warnings when `site_host` differs from your current WordPress host, helping catch origin/registered-site mismatches early.

= Which cookies are used? =
`olm_vid` (visitor identity) and `olm_utm` (attribution parameters).
These are consent-gated when a CMP is detected.

= Can developers customize tracking logic? =
Yes. The plugin exposes filters and actions including `olc_should_track`, `olc_event_payload`, `olc_conversion_payload`, `olc_visitor_id`, `olc_event_sent`, `olc_conversion_sent`, and `olc_load_mark_sdk`.
You can also enable `/events` batching via `olc_event_batch_enabled` and send custom commerce conversions by calling `OLC_Tracker::track_conversion()` from your own integration hooks.

= How can I mark internal traffic in staging? =
Add `?onelence_internal=1` to enable internal-traffic tagging in the browser SDK, or `?onelence_internal=0` to disable it.

= Is TCF required? =
No. TCF support is optional and intended for enterprise deployments that need it.
SMB teams can keep a simple consent setup without TCF-specific UX complexity.
When TCF is present, OneLence Connect stays compatible with modern v2.x consent signals and is designed to be v2.3-ready in runtime checks.

= Does OneLence Connect support OneLence Consent? =
Yes. OneLence Consent is detected as a first-class CMP and OneLence Connect consumes its analytics consent state/events in strict consent flows.

= Can I install OneLence Consent directly from OneLence Connect? =
Yes. From the Consent tab you can install and activate OneLence Consent with one click, including install status feedback in the admin UI.

= Can I track conversions outside WooCommerce? =
Yes. Trigger the `olc_track_custom_conversion` action with a conversion payload, or call `OLC_Tracker::track_custom_conversion()` directly from custom checkout integrations.

= Can I preserve plugin data on uninstall? =
Yes. Enable the **Keep Data on Uninstall** toggle in the Tracking tab before uninstalling.

= Can I track custom events and conversions without code? =
Yes. Use the **Events** tab to configure:
- Visual selector mode (capture a CSS selector by clicking on your site).
- Rules-based tracking (click/form submit/page URL match).
- Conversion routing for explicit high-intent triggers (for example thank-you page URL matches).

= How does the visual selector work now? =
Visual selector opens an in-page overlay with ranked selector candidates (confidence, reasons, match counts), pick/interact controls, undo/clear/re-pick actions, adaptive URL-match mode, and direct save/test without copy-paste. Selector sessions persist across same-origin navigation until you explicitly end the session.

= What are the safe default event settings? =
By default, OneLence Connect auto-tracks form submits and thank-you page visits as events.
Broad button-click auto-tracking is off by default to reduce noisy data.
Conversions always require explicit conversion rules.

== Changelog ==

= 1.1.1 =
* CDN deployment preserves older versioned zips and always uploads routing helpers (`.htaccess`, download script).
* Release manifest documents 1.0.1 as unavailable on the CDN; use 1.1.x or `@latest` instead.

= 1.1.0 =
* In-dashboard plugin updates from the CDN release manifest (WordPress Updates and Plugins screens).
* UI and UX improvements.
* First-class support for OneLence Consent CMP.

= 1.0.0 =
* Initial release.
