This guide covers how to install Userplane in a TanStack Start application.Documentation Index
Fetch the complete documentation index at: https://docs.userplane.io/llms.txt
Use this file to discover all available pages before exploring further.
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:
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 aUserplaneProvider 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
Add the Userplane params to your root route’s search param schema: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:
Sensitive data
Adddata-userplane-blur to any element you want blurred in recordings. See Sensitive Data Redaction for the full reference.
Metadata
Callset() inside the useEffect after initialize():
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.
| Concern | Safe? | Notes |
|---|---|---|
Static import at top of file | Yes | Module is SSR-safe |
Calling initialize() in useEffect | Yes | Runs browser-only |
Dynamic import('@userplane/sdk') in useEffect | Yes | Bundle-size optimization only |
Calling initialize() in a loader | No | Loaders run on the server |
| Missing search params in route schema | No | Router throws notFoundError |
Example app
A complete TanStack Start example is available at github.com/userplanehq/userplane-sdk-examples/tree/main/examples/tanstack-start.
| Variable | Description |
|---|---|
VITE_USERPLANE_WORKSPACE_ID | Your Userplane workspace ID |
Related articles
- Installation — CDN script placement, CSP, and redirect handling.
- Web SDK — full SDK API reference.
- Metadata SDK — attach user context to recordings.
- Sensitive Data Redaction — blur sensitive content in recordings.