=== Multi-Touch Attribution for WooCommerce ===
Contributors: kiito0
Tags: woocommerce, multi-touch attribution, attribution, ecommerce analytics, analytics
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 8.0
Requires Plugins: woocommerce
Stable tag: 0.3.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

See which traffic sources brought customers to your store on each visit before they placed an order, with detailed reports and CSV export.

== Description ==

Multi-Touch Attribution for WooCommerce (MTA) tracks the traffic source behind each customer visit, from their first visit through to purchase.

WooCommerce's built-in attribution shows only the customer's latest source before purchase. This can hide ads and other sources that appeared earlier in the journey. If you judge your marketing only by the latest source, you might turn off ads that helped the customer discover or return to your store.

The plugin reports your top sources, common source/medium combinations, the number of tracked visits involved in orders, and how its results compare with WooCommerce's standard attribution. For the full benefit, connect your store to **[Kiito](https://www.kiito.io/)**, a WooCommerce profit analytics service that brings attribution, revenue, costs, and profit data together in one clearer view of marketing performance.

= Key features =

* Multi-touch attribution for WooCommerce orders.
* See the real source and medium behind orders that would otherwise appear as Direct / Direct or a payment gateway.
* View the full journey to an order, including the first visit, visits in between, and the final visit before purchase.
* Attribution analytics for top traffic sources, source/medium combinations, tracked visit counts (touchpoints), and comparisons with WooCommerce attribution.
* UTM parameter support: `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`, `utm_id` and `utm_kiito`.
* Click ID support for Google Ads, Meta, TikTok, X, Reddit, Microsoft Ads, Google Marketing Platform and LinkedIn.
* Uses the referring website (referrer) to identify the source and medium when campaign parameters are missing.
* A panel on each WooCommerce order showing recorded store visits, source/medium, UTM details, and visitor match diagnostics.
* Export the sources recorded for orders to CSV.
* Choose the visit timeout, attribution window, and how long visit data is kept.
* Hashed privacy mode by default, with the option to store raw diagnostics for debugging.
* WP Consent API support. On stores that require opt-in consent, tracking waits until the chosen consent category is allowed.
* First-party cookie fallback tracking to help keep visits connected.
* Connect with **[Kiito.io WooCommerce profit analytics](https://www.kiito.io/)** for deeper revenue, cost, and profit reporting.

= Built for busy WooCommerce stores =

MTA stores visitor, visit, order attribution, and daily report data in its own database tables. It uses compact visit identifiers and handles attribution processing away from the main visit-recording request. Order statistics are saved when the order is captured, so admin reports do not need to rebuild every customer journey each time they load.

Automatic cleanup keeps the attribution saved with each order while removing older visit and visitor identity data according to your retention setting.

= Privacy and consent =

By default, MTA stores hashed values for sensitive diagnostics instead of raw IP addresses and user agents (browser information). Store owners can turn on raw diagnostics for debugging from WooCommerce > Multi-Touch Attribution.

MTA works with the WP Consent API and uses the `marketing` consent category by default. When your store is configured to require opt-in consent, MTA waits for permission before recording visits. Developers can change the category with the `mtawc_consent_category` filter.

The plugin uses first-party attribution cookies to connect earlier visits with later orders. Store owners are responsible for explaining this tracking in their privacy policy and configuring consent for the laws that apply to their store.

= MTA Pro visitor matching =

The free plugin includes WooCommerce attribution tracking, order capture, settings, reports, and exports. Advanced fingerprinting requires MTA Pro. With a compatible add-on, MTA can recognize returning visitors when cookies are unavailable.

= Kiito profit analytics =

MTA collects attribution data in WooCommerce. To get the full value from that data, connect your store to [Kiito](https://www.kiito.io/), where you can view attribution together with WooCommerce revenue, ad costs, margins, and profit performance.

Kiito helps store owners see not only which sources were involved in orders, but which sources are linked to profitable growth.

== Installation ==

1. Install the plugin through Plugins > Add New, or upload the `multi-touch-attribution` folder to `/wp-content/plugins/`.
2. Activate Multi-Touch Attribution for WooCommerce from the Plugins screen.
3. Make sure WooCommerce is installed and active.
4. Go to WooCommerce > Multi-Touch Attribution.
5. Review the privacy mode, visit timeout, attribution window, and data retention settings.
6. Visit your storefront using UTM parameters, then place a test order and confirm that the recorded sources appear on the order.

== Frequently Asked Questions ==

= Does MTA require WooCommerce? =

Yes. MTA adds source tracking to WooCommerce orders, so WooCommerce must be installed and active.

= Does MTA support High-Performance Order Storage? =

Yes. MTA declares compatibility with WooCommerce High-Performance Order Storage and adds its attribution metabox to the WooCommerce order screen.

= Does MTA replace WooCommerce attribution? =

MTA works independently from WooCommerce's built-in attribution. You can disable WooCommerce's attribution if you want to avoid running both systems and improve page speed.

= Does MTA track visitors without consent? =

When your store uses the WP Consent API and requires opt-in consent, MTA waits until the configured consent category is allowed before recording visits. If no consent manager is active, WordPress does not provide an opt-in status, so MTA records first-party attribution visits by default.

= Can I export attribution data? =

Yes. WooCommerce > Multi-Touch Attribution includes a CSV export for captured order attributions.

= How do I get support or share feedback? =

For questions and feedback, [contact us](mailto:wp@kiito.io). We try to answer within 24 hours.

= What happens on uninstall? =

By default, uninstalling MTA keeps its custom attribution tables, settings, and WooCommerce order metadata so you can reinstall without losing attribution data. The Data removal settings let you opt in to removing the MTA tables and settings, the order metadata, or both when WordPress deletes the plugin. Deactivating the plugin keeps the attribution data.

== Screenshots ==

1. **Order attribution path** - View every recorded visit for a WooCommerce order, including its source, medium, campaign details, time, and visitor match information.
2. **Attribution settings** - Choose attribution windows, visit retention, diagnostics, advanced fingerprint visitor matching (Pro only), and CSV exports.
3. **Attribution statistics** - Compare attribution results and review customer journeys, how purchasers were matched to earlier visits, time to purchase, and top traffic sources.

== Changelog ==

= 0.3.1 =
* Added a reproducible JavaScript build process and moved the production tracking script to the distribution asset directory.
* Added opt-in uninstall controls and separate cleanup actions for MTA database tables and WooCommerce order metadata.
* Improved the plugin documentation and WordPress.org readme.

= 0.3.0 =
* Renamed public hooks, browser identifiers and stored data with the distinctive `mtawc` prefix.
* Consolidated user settings into one validated option and adopted namespaced classes.
* Updated the base extension API to version 5 for the coordinated Pro release.

= 0.2.5 =
* Hardened CSV exports, identity creation, retention batching and request throttling.
* Improved retry handling, UTF-8 input truncation and internal schema consistency.

= 0.2.4 =
* Initial public release.
* Added first-party visit tracking and WooCommerce order attribution snapshots.
* Added order metabox, stats tab and CSV export.
* Added configurable privacy mode, attribution window, visit timeout and retention.
* Added WP Consent API support and HPOS compatibility.
* Added extension API for optional add-ons.

== Upgrade Notice ==

= 0.3.1 =
Updates the packaged tracking script and plugin documentation.

= 0.3.0 =
Updates public identifiers and the base extension API. Update compatible add-ons at the same time.

= 0.2.5 =
Hardening and reliability improvements for attribution collection and maintenance.
