> ## 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.

# SDK Overview

> Understand the two ways to integrate Userplane — the embed script and the npm SDK — and when to use each

Userplane offers two integration paths depending on how much control you need. Most teams start with the embed script and add the npm SDK later if they need programmatic control.

## Embed script (zero-code)

The embed script is a single `<script>` tag you add to your site. It handles everything automatically — loading the recorder, parsing recording links, and managing cross-tab state.

```html theme={null}
<script src="https://cdn.userplane.io/embed/script.js" data-workspace="ws_abc123" defer></script>
```

This is the recommended starting point. It works with any site and requires no build step. See [Installation](/developer/installation) for setup instructions.

## npm SDK (programmatic)

The `@userplane/sdk` package gives you a JavaScript API for full control over the recording lifecycle. Use it when you need to:

* **Trigger recordings from your UI** — open the recorder from a button, menu, or support widget instead of relying on link clicks.
* **Attach metadata** — send user IDs, account info, feature flags, or session context alongside recordings so your support team has full context.
* **Query recording state** — check whether a recording is active, get the session ID, or read connection status to build custom UI.

<Frame caption="Userplane SDK on npm">
  <img src="https://mintcdn.com/userplane/iHJrxtyvOmNXmfMS/media/developer/npm/userplane-sdk.png?fit=max&auto=format&n=iHJrxtyvOmNXmfMS&q=85&s=3aff2063ad62ae673ce89e16e38aa137" width="1900" height="957" data-path="media/developer/npm/userplane-sdk.png" />
</Frame>

```javascript theme={null}
import { initialize, open } from '@userplane/sdk';
import { setMetadata } from '@userplane/sdk/metadata';

// Initialize once on page load
initialize({ workspaceId: 'ws_abc123' });

// Attach context for support
setMetadata({
  userId: user.id,
  plan: user.plan,
  appVersion: __APP_VERSION__,
});

// Open the recorder from a support button
document.getElementById('help-btn').addEventListener('click', () => {
  open();
});
```

## Choosing the right path

|                             | Embed script       | npm SDK                      |
| --------------------------- | ------------------ | ---------------------------- |
| **Setup**                   | One `<script>` tag | `npm install @userplane/sdk` |
| **Recording links**         | Work automatically | Work automatically           |
| **Programmatic open/close** | No                 | Yes                          |
| **Custom metadata**         | No                 | Yes                          |
| **Recording state queries** | No                 | Yes                          |
| **Build step required**     | No                 | Yes                          |

You can use both together. The embed script handles the baseline, and the SDK adds programmatic capabilities on top.

## Framework guides

For framework-specific installation instructions, see the guide for your stack:

<CardGroup cols={3}>
  <Card title="React" icon="react" href="/frameworks/react" />

  <Card title="Next.js" icon="react" href="/frameworks/nextjs" />

  <Card title="Vue" icon="vuejs" href="/frameworks/vue" />

  <Card title="Nuxt" icon="vuejs" href="/frameworks/nuxt" />

  <Card title="Angular" icon="angular" href="/frameworks/angular" />

  <Card title="SvelteKit" icon="code" href="/frameworks/sveltekit" />

  <Card title="Astro" icon="code" href="/frameworks/astro" />

  <Card title="TanStack Start" icon="code" href="/frameworks/tanstack-start" />

  <Card title="Static HTML" icon="html5" href="/frameworks/static-html" />
</CardGroup>

## Next steps

* [Web SDK Reference](/developer/web-sdk) — full API for initialization, recorder control, and state inspection.
* [Metadata SDK Reference](/developer/metadata-sdk) — attach custom key-value data to recordings.
* [Installation](/developer/installation) — set up the embed script.
