Skip to main content
This guide covers how to install Userplane in a TanStack Start application.

Adding the script

The fastest way to add Userplane is the CDN embed. Add these two tags to the <head> in your root route’s <Head> component:
You can copy the snippet with your workspace ID pre-filled from Workspace Settings > Domains in the Userplane dashboard.

npm SDK

Use the npm SDK when you need programmatic control — triggering recordings from a button, attaching user metadata, or reading recording state.

Installation

Initialization

Create a UserplaneProvider component and render it inside your root route component. Use useEffect with a dynamic import() to ensure initialization runs only in the browser.

URL parameters

Important: TanStack Router validates search parameters against a Zod schema. If a route schema does not include userplane-token, userplane-action, and userplane-workspace, the router throws a notFoundError when Userplane appends those params to the URL.
Add the Userplane params to your root route’s search param schema:
Defining this on the root route means all child routes inherit it automatically. You can also use z.record(z.string()) for a more permissive catch-all if your app accepts arbitrary query parameters. If your app redirects unauthenticated users to a login page, preserve the userplane- prefixed parameters through the redirect:
See Installation for the full list of parameters.

Sensitive data

Add data-userplane-blur to any element you want blurred in recordings. See Sensitive Data Redaction for the full reference.

Metadata

Call set() inside the useEffect after initialize():
See Metadata SDK for the full API.

SSR

TanStack Start renders on the server before hydrating in the browser. @userplane/sdk is SSR-safe to import — it does not reference window or document at module evaluation time. The initialize() call must run client-side, which useEffect guarantees.

Example app

A complete TanStack Start example is available at github.com/userplanehq/userplane-sdk-examples/tree/main/examples/tanstack-start.

Example app