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

Cookieless web analytics, hosted in the EU. Adds the Nvivio script and badge to every page and shows your numbers on the dashboard.

== Description ==

[Nvivio](https://nvivio.com) counts who visits your site, where they come from and what they read, without cookies and on servers in the EU. This plugin connects your WordPress site to it:

* **The script on every page.** Fill in your site code and the plugin adds your site's script to the head of every page, exactly as Nvivio's installation page gives it. No theme files to edit.
* **Leave yourself out.** Visits by logged-in administrators are not counted, unless you want them to be.
* **Your numbers on the dashboard.** With a read-only API key, a widget on the WordPress dashboard shows visitors, pageviews and top pages for today, 7 days or 30 days, how they changed, and who is online now.
* **Your key stays on your server.** WordPress asks Nvivio for the numbers itself and keeps them a few minutes; the key never reaches a browser.
* **The Nvivio badge.** A small link, "Privacy-friendly analytics by Nvivio" in the language of your site, at the bottom of every page, in the corner, or where you put `[nvivio_badge]`. While Nvivio sees it, Free counts more pageviews and events and a paid plan pays less.
* **Referrals.** The badge links to Nvivio with your site as the referral; Settings › Nvivio gives you the link to share, and with a key it shows who signed up through it.
* **The script's options**: the queue for early calls, `data-consent="none"` for cookie mode, and `data-api` for a proxy on your own domain.

You need an Nvivio account and a site in it. The dashboard widget needs the API, which comes with the Starter plan and up; without a key, the plugin only adds the script.

= External services =

This plugin connects to Nvivio, a web analytics service of Monto Bleu BV, Belgium.

* **The script, from nviv.io.** On every page of your site (except for logged-in administrators, if you choose so), your visitors' browsers load `https://nviv.io/js/<your site code>.js` and send pageviews and events to `https://nviv.io`: the page's address, the referrer, the page title, the screen width, the browser's language, and time on page and scroll depth. Without cookies by default; a visitor is recognised with a code that changes every day, and the IP address is only used in memory for that code, never stored. Browsers that send Global Privacy Control are not counted.
* **The badge, from nviv.io.** Only when you switch it on: browsers load `https://nviv.io/badge.js`, which draws the link to `https://nvivio.com/?via=<your domain>` and, once the badge is visible, tells `https://nviv.io/badge` your site code and the page it was seen on, at most once an hour. Nothing about the visitor is sent or kept.
* **The API, at nvivio.com.** When someone who may see the widget opens the dashboard or Settings › Nvivio, your WordPress server asks `https://nvivio.com/v1` for your site's numbers, and for your badge and referrals, with your API key. Nothing about your WordPress users is sent.

Nvivio's [terms](https://nvivio.com/legal/terms), [privacy policy](https://nvivio.com/legal/privacy) and [data processing agreement](https://nvivio.com/legal/dpa).

== Installation ==

1. Upload the plugin under Plugins › Add New Plugin › Upload Plugin, and activate it.
2. In Nvivio, open your site's Settings › Installation and copy the site code (`NV-` and seven characters), or the whole script line.
3. In WordPress, paste it under Settings › Nvivio and save. The script is now on every page.
4. To check it, open your site in a private window and look at Nvivio's installation page: it says "It works" as soon as the first visit arrives.
5. For the dashboard widget: in Nvivio, under your email address › API and AI assistants, make a key with the scope "read", and paste it under Settings › Nvivio.

== Frequently Asked Questions ==

= Do I need a cookie banner? =

Not for Nvivio in its default mode, without cookies. A site in cookie mode needs consent; see [Privacy and GDPR](https://nvivio.com/docs/privacy).

= I installed it, but Nvivio sees no visit =

Logged-in administrators are not counted: check in a private window. A page cache may still serve pages without the script; empty it once. And the site's domain must be one of the domains of the site in Nvivio.

= The widget says my plan has no API =

The API comes with the Starter plan and up. The script keeps counting on every plan, and your numbers are in Nvivio. See [the plans](https://nvivio.com/pricing).

= Where does the badge go? =

At the bottom of every page, or in the bottom right corner, as you choose under Settings › Nvivio. To put it somewhere else, for example in your theme's footer, add the shortcode `[nvivio_badge]` there (a Shortcode block works in the site editor). It only counts when it is switched on in Nvivio too, under Badge and referrals, and when Nvivio sees it on your own domain.

= Who sees the widget? =

Administrators. Developers can change that with the filter `nvivio_widget_capability`, for example to `edit_others_posts` for editors.

= Can I leave out every logged-in user? =

Yes, with the filter `nvivio_print_script`: `add_filter( 'nvivio_print_script', fn( $print ) => $print && ! is_user_logged_in() );`

= Does it work with a Content-Security-Policy? =

The script has no inline code. Allow `https://nviv.io` in `script-src` and `connect-src`. The queue for early calls is the one inline line; leave it off unless you need it.

== Changelog ==

= 1.0.0 =
* First version: the script on every page, the option to leave out administrators, the script's attributes, the dashboard widget with visitors, pageviews, top pages and who is online now, and the Nvivio badge with your referral link.
