=== Tally by Outpost ===
Contributors: tallybyoutpost
Tags: analytics, revenue, woocommerce, attribution, privacy
Requires at least: 6.3
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

Revenue analytics: adds Tally's script to every page and, with WooCommerce, links each order to the visit that brought it.

== Description ==

[Tally](https://tallybyoutpost.com) is revenue analytics. It shows which sources, pages and campaigns bring in money, not just visits, and every sale it links comes with a receipt: the evidence, the method that linked it, and how sure it is.

This plugin connects your WordPress site to Tally without touching your theme:

* **Tally's script on every page.** Paste your Site ID and the script goes in the head of every page, deferred, so it never holds a page up.
* **Privacy modes.** Cookie (the default), cookieless, or consent mode for sites with a consent banner.
* **Your own visits left out.** Logged-in administrators aren't counted, unless you switch that off.
* **WooCommerce orders linked to visits.** At checkout, classic or block, the plugin saves the buyer's Tally visitor id on the order, so Tally links the sale to the visit that brought it even when the buyer never sees the order-received page.
* **Connect WooCommerce to Tally.** One button opens Tally, then WooCommerce asks you to approve, so Tally gets its API key without anyone copying keys around.

Works with WooCommerce's High-Performance Order Storage and the Cart and Checkout blocks. WooCommerce is optional: without it, the plugin adds the script and nothing else.

You need a Tally account. Tally is a paid service with 14 days free and no card needed; this plugin is free.

== Installation ==

1. Install and activate the plugin from Plugins › Add New.
2. In Tally, add your site and open its install page. Copy the `data-site` value from the snippet: 12 lowercase letters and digits.
3. In WordPress, open Settings › Tally, paste the Site ID, choose the privacy mode your site uses in Tally, and save.
4. With WooCommerce: on the same page, choose **Connect WooCommerce to Tally**. Tally opens (sign in if asked) and explains the step; choose Continue to WooCommerce, approve Tally on WooCommerce's screen, and you land on Tally's Integrations page with your store connected.

If you pasted Tally's snippet into your theme or a header plugin before, remove it, so pages aren't counted twice.

== Frequently Asked Questions ==

= Where do I find my Site ID? =

On your site's install page in Tally. It's the `data-site` value in the snippet, such as `k3xq2mfa7twp`. Pasting the whole snippet into the Site ID field works too.

= Which privacy mode should I choose? =

The one set for your site in Tally, so both sides agree. Cookie mode keeps a first-party cookie, `_tally_vid`, for a year. Cookieless mode sets no cookies and counts visitors with a hash that changes daily. Consent mode is cookieless until your consent banner calls `tally('consent', true)`.

= Does it slow my site down? =

No. The script is about 3 KB compressed, loads with `defer` and never blocks rendering. The plugin adds nothing else to your pages.

= Does it work with caching plugins? =

Yes. Every visitor gets the same tag. Only signed-in administrators get none, and caching plugins generally neither cache nor serve cached pages for signed-in users.

= What does Tally get from my WooCommerce store? =

A REST API key, which you approve on WooCommerce's own screen. That screen lists WooCommerce's standard Read/Write abilities, but Tally only reads orders and refunds and adds its own two webhooks (new and updated orders). From each order it keeps amounts, dates, status, refunds and the visitor id, plus hashes of the order key and email. It doesn't store names, addresses, phone numbers, IP addresses or line items.

= How do I disconnect my store? =

Disconnect it in Tally, which removes Tally's two webhooks from your store, then revoke Tally's key in WooCommerce › Settings › Advanced › REST API: the key stays until you do. If you only revoke the key, also delete Tally's webhooks under WooCommerce › Settings › Advanced › Webhooks.

= I added Tally's functions.php snippet for WooCommerce. Do I still need it? =

No. The plugin saves the same visitor id on the same order field, `tally_visitor_id`. You can remove the snippet.

= Can I leave out other users too? =

Yes, with the `tally_by_outpost_track_request` filter. For example, `add_filter( 'tally_by_outpost_track_request', fn( $track ) => $track && ! current_user_can( 'edit_posts' ) );` leaves out everyone who can edit posts.

= What happens when I delete the plugin? =

Its settings are removed. Visitor ids already saved on orders stay with those orders.

== External services ==

This plugin connects your site to Tally, a revenue analytics service run by Outpost (Tesseract Systems Corporation). The plugin itself makes no requests from your server; the requests below are made by your visitors' and your own browsers, and by WooCommerce once you connect it.

**Tally's script, from t.tallybyoutpost.com.** Once you save a Site ID, every front-end page loads `https://t.tallybyoutpost.com/script.js` (not for signed-in administrators while that setting is on). As visitors browse, the script sends events to `https://t.tallybyoutpost.com/api/event`: the page's address, the referring page's address, the window's width, a random id for the page view, engaged time and scroll depth, clicks on links to other sites, and goals your site defines. In cookie mode, and in consent mode after consent, it also sends the visitor id from the `_tally_vid` cookie. It never sends names or emails, unless your site calls `tally('identify', { email })`; Tally then keeps only a hash of the email. Tally's server sees the visitor's IP address and browser, as any server does; it uses the IP address for the country and city (and, without cookies, for that day's visitor hash), then discards it.

**Tally's app, at tallybyoutpost.com.** Only when an administrator chooses Open Tally, WordPress guide or Connect WooCommerce to Tally on Settings › Tally, the browser opens tallybyoutpost.com. The connect link carries your site's address. After you sign in to Tally, it sends you to WooCommerce's approval screen on your own site; if you approve, WooCommerce sends Tally a REST API key. From then on, Tally reads orders and refunds through your store's REST API, and WooCommerce sends new and updated orders to Tally's webhooks at tallybyoutpost.com.

Tally's terms of service: https://tallybyoutpost.com/terms
Tally's privacy policy: https://tallybyoutpost.com/privacy

== Screenshots ==

1. Settings › Tally: the Site ID, the privacy mode, leaving administrators out, and connecting WooCommerce.
2. WooCommerce's own approval screen, where you approve Tally's access to your store.
3. Back on Settings › Tally once the store is connected: Tally's two webhooks are active.

== Changelog ==

= 1.0.0 =
* First release: Tally's script on every page, the three privacy modes, administrators left out, the visitor id saved on WooCommerce orders (classic and block checkout), and Connect WooCommerce to Tally.
