=== Privatrak Analytics ===
Contributors: privatrak
Tags: analytics, privacy, statistics, woocommerce, cookieless
Requires at least: 6.5
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Cookieless analytics for WordPress and WooCommerce. See which buttons people use and where shoppers drop off between the cart and the purchase.

== Description ==

Privatrak shows you what people do on your site, not only which pages they open.

As soon as you add your website key, Privatrak names the clicks that matter: your menus, the search, comment and contact forms, and add-to-cart buttons. Privatrak calls these features. Each comes with details, such as the menu a link is in, or the product a button adds and its price. You see which features people use, and you can build a funnel that shows where shoppers drop off between the cart and the purchase.

Privatrak sets no cookies and stores nothing on your visitors' devices. It is built to run without a consent banner.

This plugin connects your site to a Privatrak project. You need a Privatrak account, which you can create for free at [privatrak.com](https://privatrak.com).

= What Privatrak records on your site =

* The clicks that matter, recorded as features with their details, ready to use in funnels.
* Clicks that go wrong, which Privatrak calls click problems: buttons that do nothing, that people click again and again, that respond slowly or that cause an error.
* Each completed WooCommerce order, as a custom event called `Purchase`. It carries the order's total, currency and number of items, and nothing about the customer.
* Any other button you choose. Open the Element Picker from your Privatrak project, click the button on your site and give it a name. No code needed.
* Every page view and click, recorded automatically.
* The trait `signed-in` for visitors who are signed in to your site, so you can compare them with everyone else. On sites translated with Polylang or WPML, a trait for the page's language, such as `language-de`.

Privatrak leaves out anyone who can write or edit posts on your site, including you. You can still use the Element Picker and the Click Map on your site while you are signed in.

== Installation ==

1. In WordPress, go to **Plugins › Add Plugin**, search for Privatrak and click **Install Now**, then **Activate**.
2. In your Privatrak project, open **Settings › API Keys** and copy the key of type **Your website**.
3. In WordPress, go to **Settings › Privatrak**, paste the key into **Website key** and click **Save Changes**.

The settings page then checks the key and tells you whether it is connected.

If your project lists allowed domains, add your site's domain under **Settings › Privacy › Allowed domains** in Privatrak. The settings page shows you which domain that is.

== Frequently Asked Questions ==

= Does Privatrak use cookies or store anything on visitors' devices? =

No. Privatrak sets no cookies and stores nothing on your visitors' devices, and the details this plugin sends contain no personal data. It is built to run without a consent banner.

If you add details of your own to buttons on your site, keep personal data such as email addresses out of them.

= Does it work with caching plugins? =

Yes. Cached pages carry the tracker like the rest of the page.

Some speed plugins combine, delay or rewrite JavaScript, with settings such as **Combine JavaScript** or **Delay JavaScript**. Such a setting can stop Privatrak from recording anything. If it does, add `tracker.js` to the list of files that setting leaves alone.

= Which clicks become features without any setup? =

On every WordPress site:

* Menu links, in classic and block themes, as the feature `Navigation`, with the link's text and the menu as details.
* The search button, as `Search`.
* The comment form, as `Comment`.

With these plugins:

* **WooCommerce**: add-to-cart buttons as `Add to cart`, with the product's name, number, category and price. Products with sizes or other variations have no single price until the shopper picks one, so their buttons come without it. Product reviews as `Review`. Each completed order as a custom event called `Purchase`.
* **Contact Form 7**: the submit button as `Contact form`, with the form's title.
* **Polylang** and **WPML**: a trait for the page's language, such as `language-de`.

Feature names are always in English, whatever language your site is in.

= What about other plugins? =

Privatrak records every page view and click on your site, whatever else you have installed. Clicks on buttons from other plugins, such as form builders and page builders, arrive with the text of the button or link.

To give them a feature name, open the Element Picker from your Privatrak project and click the button on your site. Developers can add a `data-track` attribute instead.

Write to support@privatrak.com if you would like Privatrak to name actions from another plugin, or if you need help.

= My site already uses the `data-track` attribute. What happens to it? =

Your `data-track` attributes stay as they are.

The plugin's feature names take priority over feature rules you created in Privatrak for the same clicks. This applies to clicks recorded while **Record common actions as features** is on. To keep your own rules for those clicks, switch it off.

= Why don't I see my own clicks? =

Privatrak leaves out anyone who can write or edit posts. To see your clicks recorded, open your site in a private browser window.

While you are signed in, you can still use the Element Picker and the Click Map on your site.

= How many trait keys does the plugin use? =

One for `signed-in`, and one for each language on a multilingual site. To use none, switch off **Tell signed-in visitors apart**.

= Can I load the tracker from my own domain? =

Yes. In `wp-config.php`, set `PRIVATRAK_SCRIPT_URL` to the address you serve `tracker.js` from, and `PRIVATRAK_API_HOST` to the address of the Privatrak API.

Serve `tracker-picker.js` from the same folder as `tracker.js`. The Element Picker and the Click Map load it from there.

== External services ==

This plugin connects your site to Privatrak (https://privatrak.com), a web analytics service. It sends nothing until you save a website key under **Settings › Privatrak**.

**The tracker.** Once a key is saved, every page of your site loads the tracker from api.privatrak.com. While a visitor is on a page, the tracker sends Privatrak:

* the address of the page, and of the site the visitor came from;
* for each click, the button or link clicked, its text, and the feature name and details this plugin gives it;
* for a click that goes wrong, which kind of problem it was, and for a script error only its type, such as `TypeError`, never its message;
* the time of each page view and click;
* the traits this plugin adds: `signed-in` for visitors signed in to your site, and the page's language on multilingual sites;
* on the WooCommerce order confirmation page, the order's total, currency and number of items.

The tracker never reads what visitors type into forms.

Each request also carries the visitor's IP address and browser version, as every request on the web does. Privatrak uses them only to recognise the same visitor within one day. It does not store them.

**The key check.** When you open **Settings › Privatrak**, your browser asks api.privatrak.com whether the saved key belongs to a project. It sends only the key.

**The Element Picker and the Click Map.** When you open one of them on your site from your Privatrak project, your browser loads it from api.privatrak.com. Nothing is recorded while it is open.

The service is subject to Privatrak's [terms of service](https://privatrak.com/terms) and [privacy policy](https://privatrak.com/privacy-policy).

== Screenshots ==

1. The settings page in WordPress. Paste your website key, and choose what Privatrak records.
2. A dashboard in Privatrak for a WooCommerce shop: revenue, orders and the average order, visits from a sale campaign, and which products go into the cart.
3. A funnel from a sale campaign to the purchase. It shows how many visitors reach each step and where the others leave.

== Changelog ==

= 1.0.0 =
* First release.
