Skip to main content
The @userplane/sdk package provides a JavaScript API for integrating Userplane into your web application. Use it to initialize the SDK, programmatically trigger recording flows, query recording state, and attach custom metadata. For most setups, you only need the embed script (see Installation). The SDK package is for when you need programmatic control — for example, triggering a recording from a button in your app or attaching user-specific metadata.

Installation

Initialization

initialize(options?)

Initializes the Userplane SDK. Call this once when your application loads. Subsequent calls are ignored.

Parameters

InitializeOptions

Examples

Basic initialization:
Disable auto-open (manual control):
Open with a specific recording token:
Multiple workspaces:

Recorder control

open(token?)

Opens the recording flow for the user. Returns true if the recorder was opened, false otherwise (e.g. if the SDK is not initialized or the recorder is already mounted). Returns: boolean

unmount()

Closes and unmounts the recorder. If background capture is enabled, the capture iframe is re-mounted after the recorder is removed.

isInitialized()

Returns true if the SDK has been initialized.

isRecorderMounted()

Returns true if the recorder is currently mounted and visible.

Recording state

getRecordingState()

Returns the current recording state. Returns: RecordingState — one of 'inactive', 'active', or 'retained'

getRecordingContext()

Returns the full recording context, or null if no context is available. Returns: RecordingContext | null

getSessionId()

Returns the current recording session ID, or null if no session is active. Returns: string | null

getLinkId()

Returns the recording link ID for the current session, or null if no session is active. Returns: string | null

Tab management

getTabRef()

Returns the unique tab reference for this browser tab. This is persisted in sessionStorage for the lifetime of the tab and is used internally to manage cross-tab recording state. Returns: string | null

clearTabRef()

Clears the tab reference from sessionStorage. A new reference is generated on the next initialization.

Connection state

isBridgeConnected()

Returns true if the bridge connection between the SDK and the recorder iframe is established. Useful for debugging integration issues. Returns: boolean

HTML attributes and meta tags

The SDK recognizes HTML attributes and meta tags for configuring blur and workspace identity.

Blur attributes

Use data-userplane-blur to blur sensitive elements in recordings:
To exclude an element from blur:
You can also use the .userplane-mask CSS class or <meta name="userplane:blur"> tags. See the Sensitive Data Redaction Developer Guide for the full list of blur methods and third-party compatibility.

Workspace meta tag

If you don’t pass workspaceId in initialize(), the SDK reads it from meta tags:

URL parameters

When a customer opens a recording link, Userplane appends these query parameters to the URL: The SDK parses these automatically on initialization. If your app uses custom URL routing, you can provide a custom parser via the parseUserplaneData option.

Common patterns

Trigger recording from a support button

Show recording state in your UI

Correlate recordings with your own analytics

The SDK works alongside recording links. When a customer opens a recording link on a page where the SDK is initialized, the SDK can provide additional context:
  • Custom metadata is attached to the recording.
  • Blur attributes are respected during capture.
  • Domain recording preferences are applied.