=== Joryio ===
Contributors: joryio
Tags: marketing automation, woocommerce, abandoned cart, contact form 7, elementor
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.6.35
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Connect WordPress and WooCommerce to Joryio: page tracking, website forms, in-app messages, web push, store sync and abandoned cart recovery.

== Description ==

Joryio connects any WordPress site to the Joryio marketing automation platform (a hosted service - you need a Joryio account). On every site it tracks page views, sends Contact Form 7 and Elementor Pro form submissions to Joryio, and shows Joryio in-app messages and web push. With WooCommerce active it also syncs your products, orders and customers and powers abandoned cart recovery.

(This plugin was called "Joryio for WooCommerce" before 1.6.2 and "Joryio for WordPress" before 1.6.25. It is the same plugin - same folder, settings and updates.)

Nothing is sent to Joryio until you connect the plugin with your Joryio API key. What is sent, and when, is listed under "External services" below.

= Key Features =

On any WordPress site:

* **Page tracking** - Page views and visitor activity reach Joryio through the tracking script
* **Website forms** - Send Contact Form 7 and Elementor Pro form submissions to Joryio: the contact is created or updated, a "Form Submitted" event is recorded, and each form decides whether it subscribes the contact to a list (always, for a signup form, or only when its consent box is ticked)
* **In-app messages and web push** - Show Joryio in-app messages (popups) on your site and let visitors subscribe to browser notifications

With WooCommerce:

* **Abandoned Cart Recovery** - Automatically track and recover abandoned carts with personalized email campaigns
* **Customer Identity Tracking** - Capture customer emails early in the shopping journey
* **Real-time Data Sync** - Products, orders, and customers sync automatically to Joryio
* **Cart Recovery Links** - One-click cart restoration for returning customers
* **UTM Tracking** - Capture marketing attribution data for better campaign analysis
* **Marketing Consent Checkbox** - Collect email (and optionally SMS) opt-ins on checkout and registration, with the evidence recorded on each order

= How It Works =

1. Install the plugin from Plugins > Add New (search for "Joryio") and activate it
2. In your Joryio dashboard, go to Settings > Integrations > WooCommerce & WordPress and copy the server URL and API key
3. Paste them in the plugin settings (WooCommerce > Joryio on a store, Settings > Joryio on a site without WooCommerce) and click Connect
4. A store syncs automatically; a site without WooCommerce starts sending page tracking, forms, in-app messages and web push

= Abandoned Cart Tracking =

The plugin tracks cart contents in real-time. When a customer adds items to their cart, their session is tracked. If they leave without completing their purchase, Joryio can send automated recovery emails with a personalized link to restore their cart.

= Customer Identity =

The plugin captures customer emails from:
* Checkout form
* Account registration
* Newsletter signup forms
* Any email input field

This allows Joryio to associate cart data with customer profiles for personalized marketing. You can turn off "Recognise visitors by the email they type" in the settings so that only signed-in customers are recognised.

= Your visitors' privacy and consent =

* The plugin contacts Joryio only after you connect it with your API key, and stops when you disconnect.
* The tracking script can be turned off in the settings ("Inject Tracking Script"); in-app messages and web push have their own settings, and web push is off until you turn it on. A visitor is asked by their browser before any push notification is shown.
* The marketing consent checkbox (checkout and registration, off until you turn it on) records what the shopper saw and chose on the order. A box ticked by default counts only after the shopper touches it, and by default the opt-in counts only when the order is placed.
* Website forms subscribe a contact to a list only as each form is set up: always (a signup form) or only when its consent box is ticked.
* You are the controller of your visitors' data. Mention Joryio in your site's privacy policy and, where your visitors' law requires it, ask for cookie consent before the tracking script runs (for example with a cookie consent plugin that holds back scripts until consent is given).

The storefront sets these first-party cookies: `joryio_client_id` (an anonymous visitor id, 1 year), `joryio_session` (the cart session, 30 days), `joryio_email` (an email the visitor typed, kept in their own browser, 30 days), `joryio_utm_*`, `joryio_jr_cid` and `joryio_jr_jid` (the campaign and message ids of a Joryio link they followed, 30 days), `joryio_li` (a random value telling the storefront the sign-in changed, no user data) and `joryio_pending` (a short-lived flag for add-to-cart events).

= Source code =

The plugin ships as readable source, with no build step and nothing minified. The web SDK it loads from sdk.joryio.com is Joryio's hosted JavaScript library for the service (see "External services").

= Requirements =

* WordPress 6.0 or higher
* WooCommerce 5.0 or higher for the store features (cart, orders, products, coupons, checkout consent). Without WooCommerce the plugin still connects your site for website forms, the tracking script, in-app messages and web push
* Contact Form 7, or Elementor Pro, for website forms (optional)
* PHP 7.4 or higher
* A Joryio account

== External services ==

This plugin connects your site to Joryio, a hosted marketing automation service run by Joryio. It is needed for everything the plugin does: the plugin is an interface to your Joryio account. Nothing is sent before you click Connect with your Joryio API key, and nothing is sent after you click Disconnect.

Joryio terms of service: https://www.joryio.com/legal/terms-of-service
Joryio privacy policy: https://www.joryio.com/legal/privacy-policy
Data processing agreement: https://www.joryio.com/legal/dpa - subprocessors: https://www.joryio.com/legal/subprocessors

= 1. Joryio API (your region's server, for example https://api-eu1.joryio.com or https://api-us1.joryio.com) =

The server URL you paste when you connect. Requests go from your site's server, and from your visitors' browsers for the storefront events:

* **When you connect, test or disconnect:** your API key, the site URL and name, the WordPress, WooCommerce and plugin versions, the site's time zone and (on a store) currency. On a store, the plugin creates a WooCommerce REST API key ("Joryio Integration", read/write) and sends it to Joryio, which uses it to read your products, orders, customers and coupons, to register its WooCommerce webhooks and to create the coupon codes your campaigns use. Disconnect deletes that key and the webhooks.
* **When store data changes (WooCommerce):** products (name, price, images, categories, stock), orders (items, totals, payment method and status, the customer's name, email, phone and addresses, the consent the shopper gave (the wording of the box, the page and the shopper's IP address)), customers (email, name, phone, addresses, order history) and carts (contents, the shopper's email when known, the recovery link, and for a guest the anonymous visitor id from the shopper's own cookie).
* **On storefront pages (tracking script, when it is on):** page views, product and category views, add to cart, checkout started, and the anonymous visitor id; an email address the visitor types in a form or at checkout (and the name typed with it at checkout), unless "Recognise visitors by the email they type" is off; for a signed-in customer, a signed proof of their customer id.
* **When a website form is submitted (Contact Form 7, Elementor Pro):** the fields you map in the form's Joryio settings, the form's name and page, and the consent box when the form has one. When the form's consent box is ticked, also the box's wording and the submitter's IP address, kept by Joryio as consent evidence. When the person submitting is a logged-in customer (1.6.34), a signed proof of their customer id, made for that one submission, so Joryio can let the form update that customer's own phone number. The settings page also reads your Joryio lists for the form setup.
* **When a shopper ticks or unticks the checkout opt-in (with "Record consent immediately"):** the box, its new value, the session's email and the shopper's IP address, kept by Joryio as consent evidence.
* **With every request:** your plugin settings that Joryio follows or shows on your store's page: the checkout opt-in settings, "Recognise visitors by the email they type", "Track guest carts" and the abandonment time.

= 2. Joryio web SDK (https://sdk.joryio.com) =

When in-app messages (on by default) or web push (off by default) are on, the storefront loads Joryio's JavaScript library from https://sdk.joryio.com/web/1/joryio.min.js in the visitor's browser. It shows the in-app messages you publish in Joryio (with "Allow HTML in-app messages" on, messages built with the HTML editor are shown in a separate frame whose Content Security Policy blocks every script written into them; they can show images, fonts and video loaded over HTTPS, but cannot run code on your pages, fetch data or submit forms themselves) and, with web push on, asks the visitor for permission and registers the browser for push notifications. It sends the anonymous visitor id, the messages shown and clicked, and the browser's push subscription to your Joryio API server. With web push on, the service worker at /joryio-sw.js on your site loads https://sdk.joryio.com/web/1/joryio-sw.js to show the notifications.

Links in the emails and messages Joryio sends (for example cart recovery and coupon links) point back to your site; when you set up click tracking in Joryio they pass through Joryio's tracking domain first. The plugin itself does not contact that domain.

== Installation ==

1. In WordPress, go to Plugins > Add New, search for "Joryio", click Install Now and then Activate. (Or download the zip from the Joryio dashboard - Settings > Integrations > WooCommerce & WordPress > Download Plugin - and upload it under Plugins > Add New > Upload Plugin.)
2. Go to WooCommerce > Joryio in your WordPress admin (Settings > Joryio on a site without WooCommerce)
3. Copy the server URL and API key from your Joryio dashboard (Settings > Integrations > WooCommerce & WordPress)
4. Paste both and click Connect
5. A store syncs automatically with Joryio. Your settings are on the tabs of the same page (Tracking & identity, Store, Consent, In-app & web push, Forms); on a site without WooCommerce, set up your forms on the Forms tab

= Updating =

WordPress updates the plugin like any other plugin from the plugin directory. A copy uploaded from the Joryio dashboard zip is the same plugin in the same folder, so it gets the same updates. Settings and the connection are kept.

== Frequently Asked Questions ==

= Do I need a Joryio account? =

Yes, you need a Joryio account to use this plugin. Sign up at joryio.com.

= Do I need WooCommerce? =

No. Without WooCommerce the plugin connects your site for page tracking, website forms (Contact Form 7, Elementor Pro), in-app messages and web push. The store features (product, order and customer sync, abandoned carts, coupons, the checkout consent checkbox) turn on with WooCommerce. If you add WooCommerce later, disconnect and connect again so Joryio can sync your store.

= What data is synced to Joryio? =

On a WooCommerce store the plugin syncs:
* Products (name, price, images, categories, stock status)
* Orders (items, totals, customer info, shipping/billing addresses)
* Customers (email, name, order history)
* Abandoned carts (cart contents, customer email if known)

= Is customer data secure? =

All data is sent to Joryio over HTTPS. What is sent, and when, is listed under "External services"; how Joryio handles it is in the Joryio privacy policy (https://www.joryio.com/legal/privacy-policy).

= Does the plugin ask my visitors for cookie consent? =

No. The plugin does not show a cookie banner. Where your visitors' law requires consent before tracking, use a cookie consent plugin that holds back scripts until the visitor agrees, or turn off "Inject Tracking Script" in the settings. The marketing consent checkbox at checkout is a separate thing: it records whether a shopper agreed to receive marketing.

= Will this slow down my site? =

No, the plugin is designed to be lightweight. Store data is sent in the background (WP-Cron); a cart change, and the abandoned-cart check, are sent at the end of the visit, after the page is sent on PHP-FPM and LiteSpeed servers.

= How do I run the abandoned-cart check by hand? =

Run `wp cron event run --due-now` (WP-CLI), or request `https://your-store/wp-cron.php` without a `doing_wp_cron` value. A request that carries a `doing_wp_cron` value runs nothing unless the value is exactly WordPress's own current lock. What the check reported is in WooCommerce > Status > Logs, source "joryio".

= How long before a cart is considered abandoned? =

By default, a cart is considered abandoned after 30 minutes of inactivity. You can change it under WooCommerce > Joryio > Store ("Cart Abandonment Time").

= Does it work with a page cache? =

Yes. The tracking script is the same on every page and holds nothing about the visitor (no email, session or user id), so a page cache (Breeze, WP Rocket, LiteSpeed Cache, W3 Total Cache, WP Super Cache, WP Fastest Cache, SiteGround Optimizer, Cloudflare) may store it. Who is signed in is asked by the script itself, through a request that is never cached. A page cached before you connected has no Joryio script: the plugin empties the cache of those plugins when you connect, disconnect, change the tracking settings or update the plugin. With any other cache (a host's server cache, Varnish, a CDN), purge it yourself after connecting.

= Can I use this with other marketing plugins? =

Yes, Joryio works alongside other plugins. There are no known conflicts.

== Screenshots ==

1. Connection tab: connection status, Test connection and Disconnect
2. Store tab: cart abandonment time, recovery links and guest carts
3. Consent tab: the marketing consent checkbox

== Changelog ==

= 1.6.35 =
* The web push service worker is now served by WordPress itself at the same address, /joryio-sw.js, generated from your settings. The plugin no longer writes any file to your site folder (WordPress.org review). Browsers that already subscribed keep working: the address is unchanged
* The joryio-sw.js file an earlier version wrote to your site folder is deleted once by this update, and only when it is exactly the file the plugin wrote; a file you changed is left alone
* Some web servers answer .js addresses themselves and never pass a missing file to WordPress. With web push on, the In-app & web push tab now checks the address and says so; ask your host to pass /joryio-sw.js to WordPress
* The storefront's calls to your site (the typed email, the signed-in customer proof, the queued add-to-cart events) now also carry a WordPress nonce. It is never printed into the page, so full-page caches keep working: the tracking script asks for a fresh one when it needs it
* Saving a settings tab now needs the same permission that opens the page (Manage WooCommerce on a store), and the registration consent box checks the registration form's own nonce
* The plugin's admin notices (no API key saved, reconnect after WooCommerce was activated) now show only on the Plugins screen and the Joryio settings page, to users who can act on them. The reconnect notice can be dismissed; the choice is kept per user. Nothing else changes

= 1.6.34 =
* A signed-in customer can update their phone number through a website form. When a logged-in customer submits a Contact Form 7 or Elementor form, the plugin now sends a signed proof of who is logged in (the same signed proof the storefront sign-in uses, made on your server and good for that one submission only). When the form's email belongs to that same customer's contact in Joryio, the phone typed into the form replaces the contact's phone; the email never changes this way
* A visitor who is not logged in changes nothing that is already there: the form fills an empty email or phone only, as before. The proof is sent only for a form submitted on your own site (a form posted from another site in the customer's browser gets none)
* The form's email and phone are kept on the Form Submitted event in Joryio, so a different phone a visitor typed is no longer lost; the event says whether the contact took it
* Needs a Joryio release later than 2026-11-03 (an older Joryio refuses the new field, and that submission is not recorded); nothing to configure
* A Contact Form 7 form that submits through the WordPress REST API without the REST nonce is seen by WordPress as logged out; it sends no proof and the visitor rule applies
* On a WordPress site without WooCommerce, the In-app & web push settings tab now says "your site" and "visitors" instead of "your store" and "shoppers"
* The "External services" section of the readme now lists everything sent: a ticked form consent box's wording and the submitter's IP address (since 1.6.31), the wording, page and IP address with an order's consent, and the signed-in customer proof sent with a form (1.6.34)
* The "Allow HTML in-app messages" help text and the readme now say exactly what an HTML message can do: it is shown in a separate frame whose Content Security Policy blocks every script written into it; it can show images, fonts and video loaded over HTTPS, but cannot run code on your pages, fetch data or submit forms itself

Earlier versions: see changelog.txt in the plugin folder.

== Upgrade Notice ==

= 1.6.35 =
The web push service worker is served by WordPress at the same address; the plugin no longer writes a file to your site folder. Storefront calls carry a nonce, and admin notices show only on the Plugins screen and the Joryio page.

= 1.6.34 =
A signed-in customer's website form can update their phone; a visitor's form still fills only an empty email or phone. The readme's External services section and the HTML in-app message help text are brought up to date.

= 1.6.33 =
A mistyped email corrected at checkout replaces the earlier one in Joryio; an email typed into a website form never does.

= 1.6.32 =
The settings page is in tabs (Connection, Tracking & identity, Store, Consent, In-app & web push, Forms); each tab saves only its own settings. Nothing to change.

= 1.6.31 =
Website forms send the consent box's wording, and orders and registrations send the shopper's IP and page, so Joryio records the full consent proof.

= 1.6.30 =
A guest's cart stays with the guest's visitor profile, so it follows the email typed at checkout (also a corrected one).

= 1.6.29 =
A personal coupon code from a Joryio message now works for guests: it is applied when the shopper enters the email it was sent to at checkout.

= 1.6.28 =
A cart a customer changes - also one already reported abandoned - reaches Joryio right away, and abandoned carts are reported on time even when WP-Cron runs late.

= 1.6.27 =
Adds an optional, off-by-default setting: an unticked consent box at checkout or registration unsubscribes the person (signed-in customers only unless you also allow guests).

= 1.6.26 =
On a shared browser, each person who signs in (or the next visitor after a sign-out) gets their own visitor - their visit no longer goes to the person before.

= 1.6.25 =
Ready for the WordPress.org plugin directory: the plugin is now called "Joryio" and requires WordPress 6.0. Nothing changes in how it works.

= 1.6.24 =
Abandoned carts are reported on time in every time zone, and Joryio's fallback follows "Track guest carts" and your abandonment time.

= 1.6.23 =
A cart restored from a recovery link in another browser shows in Joryio as a copy of the original cart, not as a cart with no contact.

= 1.6.22 =
New setting "Recognise visitors by the email they type" (on by default). Turn it off for strict identity: only signed-in customers are recognised.

= 1.6.21 =
Signed-in customers are recognised without a duplicate contact; customers created in wp-admin reach Joryio. If any admin page says no API key is saved, disconnect and connect again.

= 1.6.20 =
Cash on delivery orders show "Awaiting payment" in Joryio until they are completed, instead of "Paid".

= 1.6.19 =
Saving the settings no longer erases the API key; the storefront script holds no visitor data, so page caches are safe. If the settings page says no API key is saved, disconnect and connect again.

= 1.6.8 =
Safe web SDK loading on sites that use RequireJS.

= 1.6.7 =
The storefront script works with a Content Security Policy that uses nonces.

= 1.6.6 =
Logged-in customers join their existing Joryio contact instead of creating a second one.

= 1.6.5 =
A refused connection no longer leaves a REST API key behind, and the reason for it is shown.

= 1.6.4 =
Corrected help text for "Allow HTML in-app messages". No behaviour change.

= 1.6.3 =
A delayed or retried order update no longer rolls an order back to an earlier status in Joryio.

= 1.6.2 =
The plugin is renamed "Joryio for WordPress". Nothing else changes - your settings and connection are kept.

= 1.6.1 =
Orders say whether the customer was logged in, so a logged-in customer's marketing tick can re-subscribe them in Joryio.

= 1.6.0 =
Adds Contact Form 7 and Elementor Pro forms, with a per-form list-subscription mode, and lets the plugin run on WordPress sites without WooCommerce.

= 1.5.0 =
Shows Joryio in-app messages on your store (on by default) and adds optional web push (off by default).

= 1.4.0 =
Adds coupon apply links for the codes Joryio creates in your store, and shows which coupons Joryio made.

= 1.3.1 =
Tracks add to cart from product pages and the WooCommerce Blocks buttons, checkout started on the Checkout block, and category page views. Also sends the discount of each coupon code on an order.

= 1.3.0 =
Adds an optional marketing consent checkbox for checkout and registration (off until you turn it on), and sends block checkout orders as soon as they are placed.

= 1.2.1 =
Fixes activation when an older copy is installed, and the default server URL.

= 1.2.0 =
Restores server-side order, product, cart and customer sync (previously sent in a format the server no longer accepted), makes checkout non-blocking, and stops duplicate abandoned-cart emails. Upgrade recommended for all stores.

= 1.1.0 =
Fixes storefront tracking (events previously went to an unreachable endpoint). Upgrade recommended for all stores.

= 1.0.0 =
Initial release.
