> ## Documentation Index
> Fetch the complete documentation index at: https://confidence.spotify.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting Started

> Install the Recording SDK and create your first recording.

## Before You Begin

You need:

* A Confidence account with Recordings enabled
* A browser client secret for the environment you want to record
* Permission to create or edit a recording policy
* A recording policy with an active rule for your client

To create a policy, you need the Account Owner, Admin, Super Admin, Creator, or
Recording Policy Creator role. An Editor or Recording Policy Editor can edit an
existing policy but cannot create one.

## Set Up the SDK

<Steps>
  <Step title="Install the package">
    ```bash theme={null}
    npm install @spotify-confidence/session-recording
    ```
  </Step>

  <Step title="Review the privacy controls">
    The SDK masks input values by default. Review [privacy and data masking](/docs/recordings/privacy)
    before you enable recording in a production environment.
  </Step>

  <Step title="Initialize the recorder">
    ```typescript theme={null}
    import { initSessionRecorder } from '@spotify-confidence/session-recording';

    const recorder = initSessionRecorder({
      clientSecret: '<your-client-secret>',
      appVersion: '2.3.1',
      context: {
        plan: 'premium',
        checkout_version: 'one-page',
      },
    });
    ```

    `appVersion` stores an application version or commit hash on the recording.
    Confidence uses context to evaluate recording rules before capture starts. Do not
    add direct personal identifiers, access tokens, or secrets to context.

    The SDK uses automatic mode by default. It starts capture when the session matches
    an active recording rule.
  </Step>

  <Step title="Verify recording">
    Interact with the application and check `recorder.isRecording`. It becomes `true`
    after capture starts.

    A `false` value does not always indicate an error. A rule, sample rate, or
    account capacity can exclude the session.
  </Step>

  <Step title="Finish the test session">
    Close the test tab. If other tabs share the browser session, close those tabs too.
    Each tab appears as a separate recording. Allow several minutes after the browser
    session ends before you check **Recordings**.
  </Step>
</Steps>

## Add Debug Logs

Pass a logger while you set up the SDK:

```typescript theme={null}
const recorder = initSessionRecorder({
  clientSecret: '<your-client-secret>',
  debugLogger: message => console.debug(message),
});
```

The logger reports when recording starts, when Confidence skips the session,
connection changes, and worker errors. The SDK returns a recorder and does not throw
setup errors to the application.

## Customize Recordings

<CardGroup cols={2}>
  <Card title="Configure privacy" href="/docs/recordings/privacy">
    Mask or block sensitive content before it leaves the browser.
  </Card>

  <Card title="Configure recording rules" href="/docs/recordings/recording-rules">
    Control which users and sessions the SDK records.
  </Card>

  <Card title="Add custom data" href="/docs/recordings/custom-data">
    Add context, tags, and measurements.
  </Card>

  <Card title="Parameterize routes" href="/docs/recordings/route-parameterization">
    Group dynamic application routes.
  </Card>

  <Card title="Integrate feature flags" href="/docs/recordings/feature-flag-integration">
    Keep recording and feature flag targeting context consistent.
  </Card>
</CardGroup>

## Related Resources

<CardGroup cols={2}>
  <Card title="Explore recordings" href="/docs/recordings/explore-recordings">
    Learn what you can review in the Confidence UI.
  </Card>

  <Card title="SDK reference" href="https://github.com/spotify/confidence-sdk-js/tree/main/csr/session-recording">
    Review all SDK options and methods.
  </Card>

  <Card title="Troubleshoot recordings" href="/docs/recordings/troubleshooting">
    Diagnose SDK setup and capture problems.
  </Card>
</CardGroup>
