SDK setup & configuration

Install the official TypeScript SDK from npm, then call init() once at process startup (or once per serverless isolate) before tracking or wrapping clients.

Install

Terminal
npm install @noryen/sdk

Initialize

init.ts
import { noryen } from "@noryen/sdk";
noryen.init({
apiKey: process.env.NORYEN_API_KEY,
// optional: debug: true,
// optional: endpoint: "https://your-host.example.com/v1/track",
});

Endpoint resolution

The SDK sends batches to a track URL. Resolution order is:

  1. init({ endpoint }) if you pass it
  2. First set environment variable among NORYEN_API_URL, NORYEN_TRACK_ENDPOINT, NEXT_PUBLIC_NORYEN_API_URL
  3. Hosted default — see the @noryen/sdk README on GitHub for endpoint options and self-hosting the API.

Debug mode

Pass debug: true to log tracked payloads and wrapper warnings to the console. Use only in non-production or short-lived debugging sessions.

Call init() before track() or wrappers. Calling init() again reinitializes the client and logs a warning.

Next: Tracking events or Wrappers.