Sign inGet started
Tracking

WordPress and WooCommerce

View as MarkdownOpen in ChatGPTOpen in Claude
Connect your agent
Add to CursorAdd to VS Code

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?

  1. In WordPress, go to Plugins > Add New Plugin, search for nextanalytica, then click Install Now and Activate.
  2. Go to Settings > nextanalytica and click Connect nextanalytica.
  3. Sign in to nextanalytica. Signing in for the first time also creates your account.
  4. Choose your site's project, or New project for your domain, then choose where its data is kept.
  5. You're back in WordPress with "Connected. The tag is on every public page."
  6. 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:

Terminal
wp nextanalytica set na_…
CommandWhat 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 statusShows the key, the settings and whether WooCommerce and the WP Consent API are there.
wp nextanalytica live-siteSays this copy is the live site, after its address changed.
wp nextanalytica disconnectTakes the tag off every page and forgets the server key.

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:

  1. In nextanalytica, go to Tracking > Keys and make a server key. It's shown once.
  2. In WordPress, paste it under Server key (optional) in Settings > nextanalytica, and click Save.

From then on, your site's server sends:

OrderWhen
Paid later, never sent from the order-received page30 minutes after it's paid
The order-received page found the tag blocked5 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 onThe tagOrders and AI crawler hits from the server
The same address, with or without wwwOnOn
A subdomain of it, such as staging.shop.examplePausedPaused
Any other addressOn (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.

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.

Next steps

Related
  • What the tag collects: Page views, clicks, forms, scroll, errors and page speed, counted without code. What never leaves the page.
  • Add the tag: Put one script line in the head of every page. Where it goes in plain HTML, site builders and each framework.
  • Cookieless counting and consent: The tag counts without cookies until a visitor agrees. How consent works, from your banner or your code.
  • Custom events: Send your own events and orders, such as sign-ups, demo requests and purchases, with one line of JavaScript each, so revenue ties to the visit.
  • Identify people: Name signed-in people with identify, so their visits on every device make one profile your agent can read. It works only after the visitor's consent.
  • Subdomains, domains and Safari: Keep one visitor across your subdomains and your other domains, and stop Safari from forgetting returning visitors after 7 days.
Still have questions?
Was this page useful?