=== NextRise Analytics ===
Contributors: nextriseanalytics
Tags: woocommerce, welcart, analytics, ecommerce, conversion
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.6.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Send WooCommerce or Welcart order data to NextRise Analytics and install its tracking tag. No settings to fill in, no code to paste, no theme edits.

== Description ==

NextRise Analytics is an ecommerce analytics service that turns your store's numbers into
specific, priced suggestions for growing revenue. This plugin is the WordPress connector
for it, and works with **WooCommerce** and **Welcart**. On a site with neither, it installs
the tracking tag only.

There is nothing to configure. You install the plugin, press **Connect to NextRise**, press
**Allow** on the page that opens, and two things start at once:

* The tracking tag is installed for you (you never edit your theme).
* Orders — amount, products, quantities — are sent as they are placed.

= Why orders have to be sent =

That a purchase happened can be worked out from the URL of your order-received page. **How
much it was for is not in the URL**, so a tracking tag on its own leaves revenue at zero.
This plugin sends the amount from your store the moment an order is placed, so revenue,
average order value and per-product analysis work from the first day.

Refunded and cancelled orders are withdrawn automatically. Partial refunds update the order
to the remaining amount.

= You need a NextRise Analytics account =

The plugin is a connector for an external service and does nothing on its own. A free
7-day trial is available at https://nextriseanalytics.com — no credit card required.

== External services ==

This plugin connects to **NextRise Analytics**, an external analytics service, to send your
store's order data and to load its tracking script. The plugin does nothing until you
connect it, and connecting is an explicit action you take in the WordPress admin.

**Connecting.** Pressing *Connect to NextRise* opens `https://app.nextriseanalytics.com` in
your browser with your store URL and a return address, so you can approve the connection
while signed in to your NextRise account. Approving returns a single-use code that expires
in 15 minutes; the plugin exchanges it server-to-server for a secret key. No long-lived key
is ever placed in a URL.

**Order data.** When an order is placed or its status changes, and when you run a manual
import of past orders, the plugin sends the following to `https://api.nextriseanalytics.com`.
On WooCommerce this means orders that reach *processing* or *completed*; on Welcart it means
every order except cancelled ones and estimates, matching Welcart's own sales totals.

* order ID, order date and currency
* line items: product ID, product name, SKU, quantity and revenue
* tax, shipping and order total
* on WooCommerce only, the order attribution WooCommerce already records on the order
  (referrer type, campaign parameters and device type). Welcart does not record this, so
  nothing is sent in its place.

**Customer names, postal addresses, email addresses and phone numbers are never sent.** The
service does not receive anything that identifies an individual shopper.

**Daily report.** Once a day the plugin sends its own version, your site URL and the number
of orders in your store, so the service can tell you whether any orders failed to arrive.

**Tracking script.** Unless you turn it off in the plugin settings, the plugin adds
`<script src="https://api.nextriseanalytics.com/n.js">` to your public pages. That script is
served by NextRise Analytics and records page views and purchases. It uses no cookies and no
browser storage, so it needs no consent banner. Admin pages (`/wp-admin`, `/wp-login`) are
excluded.

Service: https://nextriseanalytics.com
Terms of service: https://nextriseanalytics.com/legal/terms
Privacy policy: https://nextriseanalytics.com/legal/privacy

== Installation ==

1. Activate the plugin.
2. Open **NextRise Analytics**. It appears under **WooCommerce** on a WooCommerce store,
   under **Welcart Shop** on a Welcart store, and under **Settings** on a site with neither.
3. Press **Connect to NextRise**, then press **Allow** on the page that opens.

If your server cannot reach the internet from the admin screen, you can connect from the
command line instead: `wp nextrise_pair <connection code>`.

== Frequently Asked Questions ==

= What if I install the tracking tag myself? =

Tick **I install the tracking tag myself** in the plugin settings. The tag will not be added
twice.

= Will this slow my store down? =

Orders are sent independently of checkout, so shoppers are never kept waiting. Importing past
orders is spread out on purpose so your server is not overloaded.

= What happens to my data if I disconnect? =

Orders already sent stay in your NextRise account. The plugin stops sending orders and stops
adding the tracking tag.

= Can I import orders from before I installed the plugin? =

Yes. The settings screen can import the last 90 days, 12 months, 24 months or everything.

== Screenshots ==

1. The overview dashboard with the "Actions to grow revenue" rail — every card names what is happening, what to do, and the monthly amount it could recover.
2. Every estimate opens into a breakdown you can check on screen: missing conversions x share of the gap counted as recoverable x average order value x recovery rate.
3. The improvement list: actions across the whole site, ranked by recoverable amount per month.
4. Page-speed diagnosis that prioritises slow pages by the revenue they carry.

== Changelog ==

= 1.6.2 =
* The order reference on the thank-you page is now printed through WordPress's inline script
  functions instead of a hand-written script tag. No change to what is measured or sent.

= 1.6.1 =
* The tracking script is now registered through WordPress rather than printed directly, so it
  behaves like any other enqueued script.
* Internal code quality fixes reported by Plugin Check. No change to what is measured or sent.

= 1.6.0 =
* Welcart is now supported. Orders are sent as they are placed, and past orders are imported
  when you connect, exactly as on WooCommerce.
* The settings page now appears under Welcart Shop (or under Settings on a site with no cart)
  instead of only under WooCommerce, where it could not be opened.
* Welcart revenue follows Welcart's own totals: cancelled and estimate orders are excluded,
  everything else is counted.
* Product views are now sent from Welcart product pages, so per-product conversion rates work
  on Welcart as they do on WooCommerce.

= 1.5.3 =
* The plugin now reports its own version and your store's order count, so the app can show
  whether any orders failed to arrive.

= 1.5.2 =
* Orders are now sent immediately and only queued if that fails. On stores where scheduled
  tasks do not run, orders no longer sit in the queue forever.
* Importing past orders is spaced out to keep memory use low on large stores.
* Disconnecting now cancels any imports still scheduled.

= 1.5.1 =
* Connecting and sending orders now retry after a temporary network error.
* Failed orders are retried later, up to three times. Previously a single failure meant the
  order never arrived.
* Errors from an earlier attempt no longer stay on screen after reconnecting.
* Added `wp nextrise_pair <code>` for servers that cannot connect from the admin screen.

= 1.5.0 =
* Order attribution (WooCommerce's own referrer, campaign and device data) is sent with each
  order, so revenue by traffic source comes from orders rather than from tracking.
* Only the type, campaign parameters and device are stored. The full referrer URL is not.

= 1.4.1 =
* Fixed refund records being sent as orders, which stopped an import part-way through and
  took the rest of the batch with it.
* After updating, run the import again for **all time**.

= 1.4.0 =
* Product views are now sent from product pages, so per-product view counts no longer depend
  on imported history.
* Line items are sent per parent product, matching how views are counted. Per-variation
  breakdowns no longer appear in the product table.
* After updating, run the import again for **all time**.

= 1.3.0 =
* Line-item revenue is now sent excluding tax, matching Shopify, WooCommerce Analytics and
  Google Analytics 4. Tax and shipping are sent separately, with refunds deducted.
* After updating, run the import again for **all time**. Orders already sent still include tax.

= 1.2.0 =
* Order total, tax and shipping are sent, so the app can break the total down.

= 1.1.0 =
* Past orders can be imported again at any time (90 days / 12 months / 24 months / all time).
* Fixed imports stopping silently at 500 orders.
* The settings screen shows how many orders were imported and when.

= 1.0.0 =
* First release. Automatic tag installation, order sending, refunds and partial refunds.

== Upgrade Notice ==

= 1.3.0 =
Line-item revenue changed to exclude tax. Re-run the import for all time after updating.
