WordPress and WooCommerce
The nextanalytica plugin for WordPress: connect in a few clicks, cookie banners through the WP Consent API and WooCommerce orders as purchases.
Updated
The nextanalytica plugin puts the tag on every public page of a WordPress site, passes your cookie banner's answer to it and counts WooCommerce orders as purchases. You connect it with a button: no code and no theme files.
How do you install it?
- In WordPress, go to Plugins > Add New Plugin, search for nextanalytica, then click Install Now and Activate.
- Go to Settings > nextanalytica and click Connect nextanalytica.
- Sign in to nextanalytica. Signing in for the first time also creates your account.
- Choose your site's project, or New project for your domain, then choose where its data is kept.
- You're back in WordPress with "Connected. The tag is on every public page."
- Open your site once. nextanalytica sees the tag and the domain turns live within about a minute.
Connect sends nextanalytica only your site's address and the address of its nextanalytica settings page, and brings back the project key. Choosing a project that doesn't have your domain yet adds the domain to it.
Can you paste the project key instead?
Yes. Under Paste a project key instead, paste the key from the Project token row on the Tracking screen, and click Save. Use this when your WordPress admin is on another address than the site, or when the site can't open nextanalytica in your browser.
How does your agent set it up?
With WP-CLI, on the server or through your host's terminal. Your agent takes the key from get_tag:
wp nextanalytica set na_…| Command | What it does |
|---|---|
wp nextanalytica set <project-key> [--[no-]wait-for-consent] | Connects the site; the tag is on every public page. Without the flag, the consent setting stays as it is. |
wp nextanalytica server-key <server-key> | Saves the server key for AI crawler hits and WooCommerce orders. |
wp nextanalytica status | Shows the key, the settings and whether WooCommerce and the WP Consent API are there. |
wp nextanalytica live-site | Says this copy is the live site, after its address changed. |
wp nextanalytica disconnect | Takes the tag off every page and forgets the server key. |
Does it work with my cookie banner?
Yes, when your banner supports the WP Consent API, as Complianz, CookieYes and Cookiebot's WordPress plugin do. The plugin passes the visitor's answer for statistics to the tag:
- A yes lets the tag recognize returning visitors.
- A no removes what the tag kept.
- No answer yet: the tag keeps counting cookieless.
To count nothing at all until a visitor agrees, tick Count nothing until a visitor agrees. It adds data-cookieless="off" to the tag. Without the WP Consent API, tell the tag the answer from your banner's code; see Cookieless counting and consent.
How are WooCommerce orders counted?
A paid order is sent once from the order-received page, with its number, total and currency, as an order. It keeps the channel the buyer came from, so your agent can say which campaign sold. Reloading the page doesn't count it again.
Some orders never reach the browser as paid: a bank transfer or cash on delivery is paid days later, and an ad blocker can stop the tag. For those, add a server key:
- In nextanalytica, go to Tracking > Keys and make a server key. It's shown once.
- In WordPress, paste it under Server key (optional) in Settings > nextanalytica, and click Save.
From then on, your site's server sends:
| Order | When |
|---|---|
| Paid later, never sent from the order-received page | 30 minutes after it's paid |
| The order-received page found the tag blocked | 5 seconds after the page opens, or 15 if the tag was still loading |
These orders count under the channel "Server". A send that fails is tried 3 times; after that, the settings page shows how many orders couldn't be sent.
With Count nothing until a visitor agrees on and a banner that uses the WP Consent API, an order whose buyer hasn't agreed when the order-received page opens is never sent, from the page or from the server, even when it's paid later.
Can you ask buyers how they heard about you?
Yes, from plugin 1.2.0. In Settings > nextanalytica, tick Ask at checkout under How did you hear about us? and click Save. The classic checkout (not the Checkout block) gets an optional field with that question. The order-received page sends the answer once as a heard_from event, then deletes it from the order. A daily clean-up deletes any answer still on an order placed more than 24 hours ago, and removing the plugin deletes any left. Your agent counts the buyers whose answer names an AI assistant; see AI crawlers.
Does it count AI crawlers?
Yes, from plugin 1.2.0, with the server key. AI crawlers never run the tag, so the plugin sends their requests from your server after the page is served. A page served from a full-page cache never reaches WordPress, so it isn't seen. See How do I set up WordPress?.
What happens on a staging copy?
Hosts often copy a site, settings and all. The plugin remembers the address it was connected on:
| The copy runs on | The tag | Orders and AI crawler hits from the server |
|---|---|---|
The same address, with or without www | On | On |
A subdomain of it, such as staging.shop.example | Paused | Paused |
| Any other address | On (nextanalytica counts only your project's domains) | Paused |
Each admin screen then says "This site's address changed since it was connected". After you move the site to a new domain, click This is the live site and add the domain to your project.
Troubleshooting
That connection didn't come from this site. Try Connect again.
The way back from nextanalytica must finish within 15 minutes, in the browser and WordPress account that clicked Connect nextanalytica. Click it again.
This link would send your project key to another address than the site, so it was stopped.
Your WordPress admin is on another address than your site. Paste the project key instead.
Why does nextanalytica say no data yet?
Open your site once in a browser without an ad blocker. A page cache can serve pages from before the plugin: clear it. To check the page, look for t.nextanalytica.app/t.js in its source.