=== Parlar Live Chat ===
Contributors: parlarchat
Tags: live chat, chat, woocommerce, customer support, help desk
Requires at least: 6.3
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.5.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds the Parlar live chat to your site. With WooCommerce, your team sees who the signed-in customer is, what is in the cart and their latest orders.

== Description ==

Parlar Live Chat puts the chat widget of [Parlar](https://parlar.chat) on every page of your site. Visitors write from a chat button; your team answers from the Parlar panel in a browser or in the Android and iOS apps.

This plugin is the connector between your site and a Parlar account. **It does nothing until you enter the server address, the site key and, optionally, the site secret that Parlar shows you.** You need a Parlar account for that: sign up at [parlar.chat](https://parlar.chat).

What the plugin does:

* Loads the chat widget on all pages of the front end.
* For a signed-in customer, sends their identity (user ID, name and email address), signed with your site secret (HMAC-SHA256), so nobody can pretend to be another customer. The secret never appears on the page: only the signature.
* With WooCommerce, sends the cart (product, quantity and price) and, for a signed-in customer, how many orders they have, their last three orders (number, date, total and status) and where to see them in your admin, so your team has them next to the conversation.
* Sends the type of the page (home, product, category, cart or checkout) so that you can choose a different welcome message for each type. The widget uses it in the browser to choose the message.
* Supports consent mode. It registers with the WP Consent API, and you choose which cookie category the chat waits for. When Parlar is set to wait for consent, the chat does not save anything in the browser or connect to Parlar until the visitor accepts that category in your cookie banner.
* Keeps the signed identity, the cart and the orders out of the page itself. The browser asks your own site for them with a POST request when the page opens, so a page cache or a CDN cannot show one customer's data to another.
* Suggests text for your privacy policy (Settings > Privacy > Policy Guide).

The plugin is translated into Spanish, French and Italian.

Parlar is a service of Parlar Chat LTD. The plugin is free software; the Parlar service has its own plans and terms (see "External services" below).

== Installation ==

1. Upload the `parlar-live-chat` folder to `/wp-content/plugins/`, or install the plugin from Plugins > Add New.
2. Activate it in Plugins.
3. Create your account at [parlar.chat](https://parlar.chat) and add your website there. Parlar shows the server address, the site key and the site secret.
4. Go to Settings > Parlar and enter the server address and the site key. Enter the site secret too if you want signed-in customers to be identified (recommended for WooCommerce stores).
5. If your cookie banner works with the WP Consent API, install that plugin as well. If it does not, you can tell the chat from your banner with `CW.consent(true)` or `CW.consent(false)`.
6. If you use a page cache or a CDN, purge it once so that pages stored earlier do not keep an older version of the chat code.

== Frequently Asked Questions ==

= Do I need a Parlar account? =

Yes. The plugin loads the chat from the Parlar service and does nothing without the server address and the site key from your account.

= Is it free? =

The plugin is free. The Parlar service has its own plans; see [parlar.chat/pricing](https://parlar.chat/pricing/).

= Does it need WooCommerce? =

No. Without WooCommerce, the plugin adds the chat to the site and, if you set a site secret, identifies signed-in users. The cart and the orders are sent only when WooCommerce is active.

= Where do I find the site key and the site secret? =

In your Parlar account, in the settings of your website. If you think the secret has been exposed, make a new one there and paste it in Settings > Parlar.

= Does it work with my cookie banner? =

It works with banners that use the WP Consent API. The setting "Cookie category" chooses which category the chat waits for (marketing by default). For other banners, call `CW.consent(true)` or `CW.consent(false)` from the banner's accept and reject events.

= Can a page cache or a CDN show one customer's cart to another? =

Not from this plugin since version 0.5.0. The page carries only settings that are the same for everyone. The signed identity, the cart and the orders come from a POST request to your own site, and caches do not store POST requests.

= Does the plugin set cookies? =

No. The chat saves a chat ID, a secret token and a few flags in the browser's local and session storage, as described in the suggested privacy text. When the chat waits for consent, it saves nothing until the visitor consents, writes, leaves an email address or sends a photo.

= Does it work on multisite? =

Yes. The settings are per site, so each site of the network uses its own site key.

== External services ==

This plugin connects your site to Parlar, a live chat service operated by Parlar Chat LTD. Without it, the plugin does not work. It needs a Parlar account, and you enter the server address of that account (for example `https://app.parlar.chat`) in Settings > Parlar.

**Parlar (app.parlar.chat)**

What it is for: the live chat on your site. Visitors write to your team from the chat widget, and your team answers from the Parlar panel.

What is loaded and sent:

* On every front-end page, the visitor's browser loads the widget script (`/widget.js`) and the chat's public settings from the server address you entered. Like any web request, these reach the service with the visitor's IP address and browser. Cloudflare, Parlar's network provider, works out the approximate country from the IP address on each page load, so the chat knows whether to wait for consent. Parlar's servers do not store the IP address.
* What visitors write in the chat (messages, photos), the name and email address they choose to give, the page they write from and its title, and a random visitor ID are sent to the service when they write. The visitor's language and the type of page (home, product, category, cart or checkout) are given to the widget by the page.
* While a visitor types in the chat's message box, the text goes to the service as it is typed, so your team can see it before the visitor sends it, unless you turn this off. If the chat waits for consent, this starts after the visitor's first message. Parlar passes this text only to your team's open panels and never stores it.
* If the visitor gives them: a rating and comment at the end of the chat (not anonymous), and an email address to get a copy of the chat or replies by email. Parlar sends those emails through its email provider, only after the visitor confirms the address, or to a signed-in customer's address.
* With the visitor's consent, or where the chat does not wait for it: the page the visitor is on, the page they came from, their language, their browser, their approximate country and their visits, so your team sees who is on the site and can write first.
* With WooCommerce, the cart (product, quantity and price) of any visitor who has items in it. For signed-in customers, if you entered a site secret: the user ID, name and email address, signed with your secret, and with WooCommerce the customer's order count and last three orders (number, date, total and status). None of this is in the page: the browser asks your own site for it with a POST request and passes it to the widget.
* When it is sent: by default, the chat waits for consent from visitors in the EU, the EEA and the UK, and from those whose country cannot be told (you can choose every visitor or nobody instead). Where it waits, these items are sent after the visitor accepts the cookie category you chose. Where it does not wait, they are sent when the page opens, even if the chat is not opened. Before consent, the button and welcome messages work without a connection. The chat connects when the visitor opens it and sends their data only when they write, leave an email address or send a photo.
* To protect the chat against abuse, Parlar keeps, for 7 days after a visitor writes, a keyed fingerprint made from their network address (HMAC). It is not the IP address itself, but it is still personal data. It is deleted earlier if the visitor withdraws consent.
* In the visitor's browser (local and session storage, no cookies) the chat keeps a chat ID, a secret token and its own state, as listed in the privacy text the plugin suggests. Where the chat waits for consent, it saves nothing there until the visitor consents, writes, leaves an email address or sends a photo. Items saved without consent are deleted when the conversation closes, or after 7 days without activity.

Conversations and visitor data are kept while the site's Parlar account exists, until the site deletes them or closes the account. A visitor who never wrote or gave a name or email is deleted after 90 days without a visit. Files are deleted after 12 months by default (the site can choose 1 month to 10 years).

For the chat, the site owner decides about its visitors' data (the controller) and Parlar processes it on the site owner's behalf (the processor) under its Data Processing Agreement, on servers in the United States, through Cloudflare's worldwide network. Parlar uses some data for its own purposes only to protect the service and to honour requests to stop emails, as its Privacy Policy explains. The Data Processing Agreement forms part of Parlar's Terms of Service, which you accept when you create your account. See the Privacy section below.

Terms of Service: https://parlar.chat/terms/
Privacy Policy: https://parlar.chat/privacy/
Data Processing Agreement: https://parlar.chat/dpa/

The plugin connects to no other external service.

== Privacy ==

The plugin stores your settings (server address, site key, site secret, cookie category and launcher option) in your site's database. It sets no cookies and stores nothing else on your server: it reads the cart and orders only to pass them to the widget. What the chat keeps in the visitor's browser is described in "External services".

Visitor data goes to the Parlar service as described in "External services". You are responsible for informing your visitors and, where the law requires it, for asking for their consent. The plugin adds suggested text to Settings > Privacy > Policy Guide. Complete it with your own details and delete what does not apply. Parlar's Privacy Policy and Data Processing Agreement, at parlar.chat, describe how the service handles the data.

== Changelog ==

= 0.5.1 =
New folder name (parlar-live-chat). From an earlier zip: note your server address, site key and secret, delete the old plugin, install this one and enter them again in Settings > Parlar.

= 0.5.0 =
* The page no longer carries the customer's signed identity, cart or orders. It carries only settings that are the same for everyone. The plugin fetches the private part from your own site with a same-origin POST request when the page opens, and POST requests are never stored by a page cache or a CDN.
* A site key with characters that a key never has, for example an email address filled in by the browser, is refused with a notice instead of being stripped and saved, which left the store without a chat.
* When updating, purge the page cache and the CDN once: pages stored before 0.5.0 still carry the old data. If signed-in pages may have been cached in the last 48 hours, make a new site secret in your Parlar account and paste it in Settings > Parlar.

= 0.4.x and earlier =
* Consent mode with the WP Consent API, a cookie category setting, the suggested privacy text, the page type for welcome messages, the order summary for signed-in WooCommerce customers, and Spanish, French and Italian translations.

== Upgrade Notice ==

= 0.5.1 =
New folder name (parlar-live-chat). From an earlier zip: note your server address, site key and secret, delete the old plugin, install this one and enter them again in Settings > Parlar.

= 0.5.0 =
The customer's identity, cart and orders no longer travel inside the page. Purge your page cache and CDN once after updating. See the changelog.
