> ## Documentation Index
> Fetch the complete documentation index at: https://statsig-4b2ff144-serverless-cloudflare.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Install Statsig Session Replay

Session Replay is supported on the Javascript or React SDKs for both desktop and mobile web users on your web application. See the instructions below to install our SDK and record user sessions.

## Option 1 - No code - Add Javascript Snippet to your website

```html theme={null}
<script src="https://cdn.jsdelivr.net/npm/@statsig/js-client@3/build/statsig-js-client+session-replay+web-analytics.min.js?apikey=[YOUR_CLIENT_KEY]"></script>
```

Get YOUR\_CLIENT\_KEY from Project Settings -> Keys & Environments. Reveal the Client API Key, copy, and paste it over the \[YOUR-API-KEY] in the snippet above.

And you're done! This will auto initialize the sdk and start recording sessions, no code required.

<Info>
  If you'd like to use your existing Statsig integration, or customize the integration further, see option 2 below. If you still want to use the script tag but also customize the integration, remove your key from the script url and initialize using the javascript code below.
</Info>

## Option 2 - Custom code - Install via Package Manager

<Tabs>
  <Tab title="Javascript" icon="js">
    <CodeGroup>
      ```bash npm theme={null}
      npm install @statsig/js-client @statsig/session-replay @statsig/web-analytics
      ```

      ```bash yarn theme={null}
      yarn add @statsig/js-client @statsig/session-replay @statsig/web-analytics
      ```
    </CodeGroup>
  </Tab>

  <Tab title="React" icon="react">
    <CodeGroup>
      ```bash npm theme={null}
      npm install @statsig/session-replay @statsig/web-analytics @statsig/react-bindings
      ```

      ```bash yarn theme={null}
      yarn add @statsig/session-replay @statsig/web-analytics @statsig/react-bindings
      ```
    </CodeGroup>
  </Tab>
</Tabs>

We recommend using autocapture as a great way to get started, but if you don’t want to automatically log and send events, you can remove the runStatsigAutoCapture option from the Javascript snippet or skip the `@statsig/web-analytics` package installation.

Next, following the [instructions for the Statsig Javascript SDK](/client/javascript-sdk), initialize Statsig with your SDK key, [user](/concepts/user) and options:

<Tabs>
  <Tab title="Javascript" icon="js">
    ```jsx theme={null}
    import { StatsigClient } from "@statsig/js-client";
    import { runStatsigSessionReplay } from "@statsig/session-replay";
    import { runStatsigAutoCapture } from "@statsig/web-analytics";

    const client = new StatsigClient(
      sdkKey,
      { userID: "some_user_id" },
      { environment: { tier: "production" } } // optional, pass options here if needed
    );
    runStatsigSessionReplay(client);
    runStatsigAutoCapture(client);
    await client.initializeAsync();
    ```
  </Tab>

  <Tab title="React" icon="react">
    ```jsx theme={null}
    import { StatsigProvider, useClientAsyncInit } from "@statsig/react-bindings";
    import { StatsigSessionReplayPlugin } from "@statsig/session-replay";
    import { StatsigAutoCapturePlugin } from "@statsig/web-analytics";

    function App() {
      return (
        <StatsigProvider
          sdkKey={YOUR_CLIENT_KEY}
          user={{ userID: "a-user" }}
          loadingComponent={<div>Loading...</div>}
          options={{
            plugins: [
              new StatsigSessionReplayPlugin(),
              new StatsigAutoCapturePlugin(),
            ],
          }}
        >
          <Content />
        </StatsigProvider>
      );
    }
    ```
  </Tab>
</Tabs>

<Info>
  If you'd like to use Conditional Triggers you must use StatsigTriggeredSessionReplay. See Configure (Next page) for more information
</Info>

That's it! Continue reading Configure to learn more about controlling who, what, and when you record sessions.
