Install

Get the recorder into your app. One CLI command, or one provider you place yourself.

Two rules decide whether an install works, and they are the same in every framework: the key has to reach the browser, and the recorder has to start in client code.

The wizard does it for you

npx @humanbehavior/wizard@latest

It detects your framework, writes the key into the right env file with the right public prefix, and places the initializer in the right file. If it finishes cleanly, skip to Verify.

Or place it yourself

Install the package:

npm install humanbehavior-js

Then start the recorder once, in client code. Pick your framework:

Wrap your app in the provider, then render <Providers> inside app/layout.tsx. The layout itself stays a Server Component — only the provider is a client component.

"use client";

import { HumanBehaviorProvider } from "humanbehavior-js/react";

export function Providers({ children }: { children: React.ReactNode }) {
  return (
    <HumanBehaviorProvider apiKey={process.env.NEXT_PUBLIC_HUMANBEHAVIOR_API_KEY!}>
      {children}
    </HumanBehaviorProvider>
  );
}

Key variable: NEXT_PUBLIC_HUMANBEHAVIOR_API_KEY.

Naming the environment variable

Your bundler only exposes variables that carry its own public prefix. Use the one your framework expects, or the key will be undefined at runtime:

FrameworkVariable
Next.jsNEXT_PUBLIC_HUMANBEHAVIOR_API_KEY
Vite (React, Vue, Svelte)VITE_HUMANBEHAVIOR_API_KEY
NuxtNUXT_PUBLIC_HUMANBEHAVIOR_API_KEY
AngularNG_APP_HUMANBEHAVIOR_API_KEY
Astro, SvelteKitPUBLIC_HUMANBEHAVIOR_API_KEY
GatsbyGATSBY_HUMANBEHAVIOR_API_KEY
Create React AppREACT_APP_HUMANBEHAVIOR_API_KEY

This key is meant to reach the browser

It is an ingestion key — it tells our service which project a session belongs to. Shipping it to the browser is the intended design, which is why every variable above is a public one and why the wizard writes it as such.

Where to find your key

In the app, open Settings → Environments. Copy an existing key from its row, or name a new one and create it. Separate keys per environment let you rotate one without touching the others.

Environments settings with the API keys list
Settings → Environments. Each key can be copied, revealed, renamed, rotated, or deleted.

Next: confirm a session actually arrived.