Developers

Analytics you can build into your product.

A TypeScript SDK, an HTTP API described in OpenAPI, and an MCP server. Give every user of your SaaS, website builder or app their own stats, under your brand.

$ npm install nahnu-analytics-sdk
setup.ts
import { createClient } from 'nahnu-analytics-sdk';
const stats = createClient(); // NAHNU_ANALYTICS_URL + NAHNU_ANALYTICS_KEY

// When someone signs up
await stats.clients.upsert(user.id, { name: user.company });

// When they add a website (calling again updates, never doubles)
const { site } = await stats.sites.upsert(website.id, {
  name: website.name,
  domains: [website.domain],
  client: user.id,
  currency: 'USD',
});

// "Tracking is working"
const { receiving } = await stats.sites.status(website.id);
Read the guide →

What the SDK does

Deep integration, not a tracking snippet.

Built for SaaS products, website builders and app platforms. Every report and goal works for this data, as for any other site.

  • Set everything up from your systemEach user becomes a client and each website a site, by your own IDs.Read the guide →
  • Track under your brandScript and visits come from every custom domain your Next.js app serves.Read the guide →
  • Record sales from your serversStripe and Shopify webhooks join the buyer’s visit, so the right source gets credit.Read the guide →
  • Count screens in your appsReact Native, Expo, or anything that can send HTTP. Works offline.Read the guide →
  • Sign users in to their portalA one-time link behind an Analytics button in your app.Read the guide →
  • Read stats straight from CloudflareShort-lived read tokens, with no WordPress in the path.Read the guide →

Ways in

Send events from wherever the action happens.

An event becomes a goal when you add one with its name. Funnels work across events and pages.

  • BrowserAny websiteDocs →
    window.NahnuAnalytics.track('Signup', { props: { plan: 'pro' } })
  • HTMLNo codeDocs →
    <button data-k-event="Signup" data-k-p-plan="pro">
  • PHPWordPress connectorDocs →
    nahnu_analytics_track( 'Lead won', array( 'revenue' => array( 'amount' => 490, 'currency' => 'USD' ) ) );
  • TypeScriptSDKDocs →
    await stats.track(request, site.id, 'Purchase', { revenue })
  • HTTPAny languageDocs →
    POST /events/{id}
    Authorization: Bearer nak_…
  • MCPAI agentsDocs →
    claude mcp add --transport http nahnu https://youragency.com/wp-json/nahnu-analytics/v1/mcp

Production-safe

Stats should never be the reason a checkout fails.

  • track() never throwsA stats hiccup can’t break a checkout. It returns false and reports to onError.
  • trackAfter()Runs after the response is sent, so pages never wait.
  • Idempotent eventsGive an event an ID and repeats within three days count once.
  • Safe retriesNetwork errors, 429s and 5xx are retried only when nothing can double, honoring Retry-After.
  • Rate-limit headersX-RateLimit-Limit, -Remaining and -Reset on every answer. 20,000 requests an hour.
  • stats.check()Says what’s wrong with the address or key, for health checks.
Errors, retries and limits, in the docs →

Fast reads

Dashboards in your app, read straight from Cloudflare.

Your server makes a short-lived read token for the sites a user may see. Reads go to Cloudflare with it: no PHP, no extra hop.

  • A token reads only the sites it names, and nothing but reads
  • Limit it to your app’s origins; it ends after its TTL (up to 7 days)
  • Renewed a minute before it ends; rotate the secret to revoke them all
Reading the stats in your app →
Your serverstats.readToken()
Your user’s browsercreateReader()
Your Cloudflareoverview · report · funnel

WordPress is not in the read path

AI agents

Ask Claude, ChatGPT or Cursor about every website.

A read-only MCP server. Connect with a click and sign in to WordPress: there is no key to copy. Nothing can be changed through it.

Ready-made prompts: a weekly summary, which websites grew, an SEO check-up, AI assistants, and conversions.

Terminal
$ claude mcp add --transport http nahnu \
    https://youragency.com/wp-json/nahnu-analytics/v1/mcp

17 read-only tools

  • list_sites
  • compare_sites
  • get_stats
  • get_report
  • get_realtime
  • get_goals
  • get_funnel
  • get_journey
  • get_conversions
  • get_site_health
  • get_retention
  • get_feedback
  • get_search
  • get_indexing
  • get_seo
  • get_ai_visibility
  • get_site_audit

HTTP API

Any language. Described in OpenAPI.

Authenticate with a platform key from Data and API › API keys. The spec ships in the package as openapi.json, and an API playground is built into wp-admin.

Some of the routesPlatform API 1.4.0
  • PUT/platform/clients/{ref}
  • PUT/platform/sites/{ref}
  • GET/platform/sites/{ref}/status
  • POST/platform/clients/{ref}/login
  • POST/platform/sites/{ref}/embed
  • PUT/platform/sites/{ref}/links
  • GET/platform/usage
  • POST/events/{id}
  • GET/stats/{id}
  • GET/stats/{id}/report
  • GET/realtime/{id}
  • POST/sites/{id}/goals

The SDK, API and MCP come with every license.

Unlimited websites. The SDK is on npm, GPL-licensed.