Docs
← Back to site

Methods and entry points

2 min readUpdated November 11, 2026

createClient() methods#

MethodDoes
clients.list() · clients.get(ref)All clients · one, with its sites and users
clients.upsert(ref, { name, kind? })Makes or updates a client (kind: client, subscriber, api)
clients.remove(ref)Removes it, its sites and its portal logins
users.list(ref) · users.add(ref, { email, name?, role?, invite? }) · users.remove(ref, email)People who sign in to a client’s portal (invite defaults to true)
users.loginLink(ref, email, { site? }){ url, signs_in }: a one-time sign-in link, 5 minutes
sites.list() · sites.get(ref)All sites · one
sites.upsert(ref, { name, domains, client, timezone?, currency?, goals?, adopt? })Makes or updates a site; returns site with site_key, snippet, connection, install
sites.domains(ref, { add?, remove? })Changes domains, keeping the others
sites.status(ref){ receiving, visitors_24h, pageviews_24h, live }
sites.link(ref, refs) · sites.links(ref) · sites.unlink(ref)Linked sites
sites.cross(ref, period)The linked sites report
sites.embed(ref, { password? }) · sites.removeEmbed(ref)The read-only dashboard address
sites.remove(ref)Removes a site
track(request, site, name, { props?, revenue?, id? })An event joined to the request’s visit; never throws
events.send(site, event or events[])Events from anywhere (up to 50) → { accepted, rejected, duplicates, errors }
stats(site, query) · report(site, name, query) · realtime(site)Stats through the API
query(body)The stats query API
usage(period)Visitors and pageviews per site and per client
readToken(input) · reader(input) · rotateReadSecret()Fast reads from Cloudflare
check(){ ok, problem, portal, version }
request(method, path, body?)Any other route

Other entry points#

ImportGives
nahnu-analytics-sdk/next<Analytics siteKey … />, track(name, opts), identify(id), view(url)
nahnu-analytics-sdk/next/servercreateProxy({ trust?, ip?, secret? }), trackAfter(stats, request, site, name, opts)
nahnu-analytics-sdk/appcreateAppClient(opts) → screen, event, identify, pause, resume, flush, pending, setEnabled
nahnu-analytics-sdk/readcreateReader({ endpoint, token }) → overview, report, realtime, summary, funnel, journey, extra
nahnu-analytics-sdkalso stripeMetadata(request, site), fromStripe(event), fromShopify(order), ApiError

TypeScript types ship with the package.

Was this helpful?