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

Connect WordPress to OneLence for reliable attribution, clearer channel insight, and confident decisions about what to scale.

== Description ==

[OneLence](https://onelence.com) is a marketing decision layer: it turns site and campaign signals into evidence you can trust, so you can decide what to scale, hold, or stop with confidence—not guesswork.

**OneLence Connect** is the official WordPress bridge. It sends dependable server-side attribution from your site into your OneLence workspace, including WooCommerce conversions, with less data loss from ad blockers and cookie restrictions. Once connected, your WordPress data feeds the same decision workflow you use in [OneLence](https://onelence.com)—from channel performance to growth priorities.

**What you get**

* **Server-side tracking** for page views and key site activity
* **WooCommerce conversion tracking** with automatic retries when delivery fails
* **Consent-aware behavior** that works with popular CMPs (and OneLence Consent when you use it)
* **Hybrid tracking mode** that combines server reliability with browser SDK features without double-counting page views
* **No-code event setup** in the Events tab—visual picker and rule builder for clicks, forms, and thank-you pages
* **Diagnostics in wp-admin** including Test Connection to validate your site before launch
* **A clear path to action**—reliable inputs for OneLence decisions, insights, and priorities in your workspace

**What you need**

* A [OneLence account](https://onelence.com) ([free trial available](https://onelence.com))
* Use **Connect to OneLence** in the plugin dashboard—your site is linked and credentials are configured automatically

Works on any WordPress site. WooCommerce is optional but fully supported for order and conversion tracking.

**Learn more**

* [OneLence — marketing decision layer](https://onelence.com)
* [WordPress setup guide](https://onelence.com/docs/integrations/start-integration/website-builder-setup/wordpress)
* [Integrations overview](https://onelence.com/docs/integrations/start-integration)

== Installation ==

1. Install and activate **OneLence Connect** from the WordPress Plugins screen (or upload the plugin folder to `/wp-content/plugins/`).
2. In wp-admin, open **OneLence**.
3. Click **Connect to OneLence** and sign in (or complete setup in your OneLence workspace).
4. Review Tracking and Store settings, then run **Test Connection** on the dashboard.

== External services ==

This plugin connects to external services. Data is only sent when tracking is enabled and your consent settings allow it.

= OneLence ingestion API =

Used to deliver server-side events and WooCommerce conversions to your OneLence workspace.

* **What is sent:** page URLs, visitor identifiers (`olm_vid`), UTM/attribution parameters, event names and properties you configure, WooCommerce order metadata when store tracking is enabled, and optional user email on login for identify events.
* **When:** on page views, configured events, conversions, and related server-side actions according to your tracking mode and consent mode.
* **Where:** `https://ingest.onelence.com`
* **Provider:** Crelora / OneLence — [Terms of Service](https://onelence.com/terms-of-service), [Privacy Policy](https://onelence.com/privacy-policy)

= Mark browser SDK (Hybrid / JS-only modes) =

Used for client-side tracking when you enable Hybrid or JS-only tracking.

* **What is sent:** the same categories of analytics data as configured in the plugin (for example page views and custom events), subject to your CMP/consent rules.
* **When:** after consent is granted (or immediately when no CMP is detected and your consent mode allows it).
* **Where:** the Mark SDK shipped inside this plugin (`assets/js/mark.browser.umd.js`). No third-party script host is used on WordPress.org builds.
* **Provider:** Crelora / OneLence — [Terms of Service](https://onelence.com/terms-of-service), [Privacy Policy](https://onelence.com/privacy-policy)

= Connect to OneLence (setup) =

Used when you click **Connect to OneLence** in wp-admin to link the site to your workspace.

* **What is sent:** OAuth/session tokens and site metadata required to obtain API credentials.
* **When:** during the connect flow initiated by an administrator.
* **Where:** OneLence web properties under `onelence.com`
* **Provider:** Crelora / OneLence — [Terms of Service](https://onelence.com/terms-of-service), [Privacy Policy](https://onelence.com/privacy-policy)

= OneLence Consent (optional separate plugin) =

Not required. If installed, OneLence Connect reads consent signals from that plugin and may forward optional coverage metrics when you enable forwarding in settings.

* **What is sent:** consent state needed for tracking decisions; optional lightweight coverage signals when forwarding is enabled.
* **When:** while visitors interact with the consent banner and when forwarding is enabled.
* **Where:** local WordPress installation (OneLence Consent plugin). Download: [onelence.com/consent/download](https://onelence.com/consent/download)
* **Provider:** Crelora / OneLence — [Terms of Service](https://onelence.com/terms-of-service), [Privacy Policy](https://onelence.com/privacy-policy)

== Privacy ==

* **Cookies:** `olm_vid` (visitor identity) and `olm_utm` (attribution parameters). These are set according to your consent mode and detected CMP.
* **Consent:** OneLence Connect reads consent signals from your CMP; it does not replace your cookie banner. Optional **OneLence Consent** is a separate plugin.
* **WordPress tools:** Personal data export is registered with WordPress privacy tools. Use **Keep Data on Uninstall** in Tracking settings if you want options retained after uninstall.
* **Policy:** [OneLence privacy policy](https://onelence.com/privacy-policy)

== Frequently Asked Questions ==

= What is OneLence? =

OneLence is a marketing decision layer for teams who want to grow with evidence, not noise. It connects attribution, conversions, and channel behavior so you can see what is working, what is blocked, and what deserves more investment—then act with confidence as you scale.

OneLence Connect is the WordPress plugin that feeds your site data into that workflow. Learn more at [onelence.com](https://onelence.com).

= Do I need WooCommerce? =

No. Page views and custom events work on any WordPress site. Enable WooCommerce options when you run a store.

= What are Relaxed and Strict consent modes? =

**Relaxed** allows limited server-side activity before consent while delaying cookies and browser SDK loading until consent is granted. **Strict** blocks all tracking (server and browser) until consent is granted.

= Will I get duplicate page views in Hybrid mode? =

No. Hybrid mode uses the browser SDK for page views and skips duplicate server-side page view emission.

= What if a WooCommerce conversion fails to send? =

The order is not marked as tracked until OneLence confirms success. Failed sends are retried automatically.

= How do I check that my site is configured correctly? =

Use **Test Connection** on the dashboard. You’ll see warnings if your registered site host does not match this WordPress site.

= Can I track custom events without code? =

Yes. Use the **Events** tab: pick elements on your site, or define rules for clicks, form submits, and thank-you page visits. Conversions always require explicit conversion rules.

= Is OneLence Consent required? =

No. Connect works with your existing CMP. OneLence Consent is optional for a OneLence-native banner and coverage insights.

= Can I keep my settings when uninstalling? =

Yes. Enable **Keep Data on Uninstall** on the Tracking tab before you remove the plugin.

== Screenshots ==

1. Dashboard with connection status and Test Connection
2. Connect tab — link your OneLence account
3. Tracking tab — modes and diagnostics
4. Store tab — WooCommerce conversion options
5. Privacy & Coverage — consent and CMP detection

== For developers ==

OneLence Connect exposes WordPress hooks for custom integrations, including `onelco_should_track`, `onelco_event_payload`, `onelco_conversion_payload`, `onelco_visitor_id`, `onelco_event_sent`, `onelco_conversion_sent`, and `onelco_load_mark_sdk`. Custom conversions can use `ONELCO_Tracker::track_custom_conversion()` or the `onelco_track_custom_conversion` action.

Full integration reference: [WordPress setup docs](https://onelence.com/docs/integrations/start-integration/website-builder-setup/wordpress)

== Changelog ==

= 1.2.3 =
* WordPress.org review: Mark SDK bundled locally and enqueued via wp_enqueue_script (no jsDelivr on directory builds).
* Directory build excludes CDN-only npm registry checks and remote Consent install/activate; Consent is download + Plugins screen only.
* Expanded External services documentation in readme.
* Plugin URI points to public WordPress setup documentation.

= 1.2.1 =
* WordPress.org review: enqueue Mark SDK via wp_enqueue_script; bundle SDK locally.
* WordPress.org build: no remote Consent plugin install; manual download + activate only.
* Plugin URI points to the public WordPress setup documentation.
* Expanded External services documentation in readme.

= 1.2.0 =
* WordPress.org distribution build with directory-ready packaging and readme.
* Dual release channels: WordPress.org updates via the plugin directory; CDN builds keep in-dashboard updates.
* Consent tab on WordPress.org builds links to OneLence Consent download instead of remote install.
* Updated compatibility headers (PHP 8.0+, WordPress 6.8 tested).
* Default Mark SDK version 0.2.1.

= 1.1.0 =
* In-dashboard plugin updates from CDN release manifest.
* First-class support for OneLence Consent CMP.
* Events tab with visual selector and rule builder.

= 1.0.0 =
* Initial release.

