Skip to main content
This guide covers how to install Userplane in a React application built with Vite.

Adding the script

The fastest way to add Userplane is the CDN embed. Add these two tags to the <head> of your index.html:
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 wrap your app with it in main.tsx.
Because Vite React apps are pure client-side rendered, you can use a static import at the top of the file — no dynamic import() or SSR guards are needed. useEffect ensures initialize() runs once after mount.

URL parameters

When a customer opens a recording link, Userplane appends userplane-token and userplane-action to the URL. If your app uses a router that strips unknown search parameters (e.g. a protected route redirect), carry the userplane- prefixed params through:
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() after initialize() to attach user context to recordings:
See Metadata SDK for the full API.

Example app

A complete React example is available at github.com/userplanehq/userplane-sdk-examples/tree/main/examples/react.

Example app