=== SiteCrumb ===
Contributors: sitecrumb
Tags: analytics, heatmaps, session recording, woocommerce, surveys
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 0.3.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds the SiteCrumb tracker to your site: analytics, heatmaps, session recordings, surveys and feedback, plus WooCommerce events.

== Description ==

SiteCrumb is self-hosted website analytics in the spirit of Hotjar. This plugin adds its tracker to every page of the site, so there is no code to paste into the theme.

* Fill in your SiteCrumb address and the site key (or paste the install snippet), and the settings page checks that SiteCrumb accepts data from the site.
* Logged-in editors and administrators are left out by default, so recordings show visitors rather than you editing pages.
* Follows the WP Consent API: with that plugin active, consent plugins that support it (Complianz, for example) decide whether a visitor is tracked. SiteCrumb counts as `statistics`; the filter `sitecrumb_consent_category` changes that. Withdrawn consent stops tracking at once and forgets the visitor in that browser.
* Optional: wait for consent without the WP Consent API (the page calls `ht('consent', true)`, e.g. from a cookie banner), and skip visitors with Do Not Track switched on.
* The tracker is kept out of the "delay JavaScript" and combine features of WP Rocket, LiteSpeed Cache, SiteGround Optimizer, Autoptimize, Jetpack Boost and Cloudflare Rocket Loader. Delayed until the first interaction, it would miss visitors who leave without one.

= WooCommerce =

With WooCommerce active, the plugin sends these custom events, for funnels, goals and finding recordings:

* `add_to_cart` with `product_id`, `variation_id`, `name`, `sku`, `quantity`, `price`, `value` and `currency`. Sent right away after an AJAX add, otherwise on the next page view. With the WP Consent API, the cookie that carries it to the page is only set for visitors who allow statistics.
* `checkout_started` with `value`, `currency` and `items`, on the checkout page.
* `purchase` with `value`, `currency`, `items`, `payment_method` and `coupon`, once per order on the thank-you page. Failed and cancelled orders are left out, and so are orders whose customer does not return to the thank-you page from the payment provider.

All text on the thank-you page and the My account pages, which show customers' names, email and addresses, is masked in recordings and heatmaps. Form inputs are masked on every page, hidden ones too (the password reset form's `reset_key` and `reset_login`, say). The order key in the thank-you and payment page addresses (`?key=`), which opens those pages, is replaced with `[redacted]` before the address leaves the browser, and so is the key in links and forms inside recorded pages (a "Pay" link, say).

Optionally the order number goes along as the custom value `orderNumber`. Add it on the Custom values page in SiteCrumb to search recordings by order.

The tracker's own `ht()` function is available to the theme and other plugins, e.g. `ht('event', 'newsletter_signup')`. The filter `sitecrumb_track_visitor` decides whether the current visitor is tracked, and `sitecrumb_strip_params` lists the query parameters hidden from page addresses (by default `key`); add your own, e.g. an invite code, to the list it returns.

== External services ==

This plugin loads the SiteCrumb tracker from the SiteCrumb server whose address you enter in the settings, and that tracker sends what visitors do on the site to the same server: pages viewed, clicks, mouse movement and scrolling, custom events, and (for sessions the site records) a recording of the page with form inputs masked. The plugin itself sends nothing anywhere until that address and a site key are filled in. The settings page asks the same server whether it accepts data for the site key.

SiteCrumb is self-hosted: the server is run by you or by whoever provides your SiteCrumb, and their terms and privacy policy apply. Mention it in your site's privacy policy.

== Installation ==

1. Upload the `sitecrumb` folder to `wp-content/plugins/`, or upload the zip under Plugins → Add New → Upload Plugin.
2. Activate it.
3. Go to Settings → SiteCrumb and paste the install snippet from SiteCrumb (Settings → Install), or fill in the address and site key.
4. Open the site in a private window and click around. The visit shows up in SiteCrumb within seconds.

== Changelog ==

= 0.3.0 =
* Renamed from HotTegla to SiteCrumb. The plugin now lives in the `sitecrumb` folder, and its filters are `sitecrumb_track_visitor`, `sitecrumb_strip_params` and `sitecrumb_consent_category`. Settings saved by the HotTegla plugin are taken over on first load; deactivate and delete the HotTegla plugin afterwards.

= 0.2.1 =
* The tracker's script tag names the query parameters to hide from page addresses (`data-strip-params`): WooCommerce's order key `key` by default, more with the `sitecrumb_strip_params` filter.

= 0.2.0 =
* Follows the WP Consent API: the tracker waits for `statistics` consent from consent plugins that support it, and stops and forgets the visitor when consent is withdrawn or has expired. The WooCommerce cart cookie is only set with consent.

= 0.1.0 =
* First version: tracker, settings page with connection check, optimizer exclusions, WooCommerce events.
