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

# Installation

> Install the Observerbee browser SDK from GitHub Packages or a CDN script tag.

The Observerbee SDK is a TypeScript browser library built on [rrweb](https://github.com/rrweb-io/rrweb). It ships as ES module, CommonJS, and UMD builds, so it works with any bundler or directly from a script tag.

## Package install

The package is `@web-analytics-ai/obweb`, hosted on GitHub Packages while Observerbee is in closed beta.

<Steps>
  <Step title="Point the scope at GitHub Packages">
    Add a `.npmrc` file to your project root:

    ```text .npmrc theme={null}
    @web-analytics-ai:registry=https://npm.pkg.github.com/
    ```

    GitHub Packages requires authentication to install. If your environment is not already logged in to `npm.pkg.github.com`, ask us for access during onboarding.
  </Step>

  <Step title="Install">
    <CodeGroup>
      ```bash npm theme={null}
      npm install @web-analytics-ai/obweb
      ```

      ```bash yarn theme={null}
      yarn add @web-analytics-ai/obweb
      ```

      ```bash pnpm theme={null}
      pnpm add @web-analytics-ai/obweb
      ```
    </CodeGroup>
  </Step>

  <Step title="Initialize">
    ```ts theme={null}
    import { SessionRecorder } from '@web-analytics-ai/obweb';

    const recorder = await SessionRecorder.init({
      apiKey: 'ob_live_your_api_key_here',
    });
    ```

    `SessionRecorder.init(config)` constructs a recorder and starts it in one call. If you need to separate construction from starting, use `createSessionRecorder(config)` and call `start()` yourself.
  </Step>
</Steps>

## Script tag install

The UMD build exposes an `Obweb` global (with `SessionRecorder` and `createSessionRecorder` also available on `window`).

```html theme={null}
<script src="https://cdn.observerbee.com/obweb/latest/obweb.min.js"></script>
<script>
  Obweb.init({ apiKey: 'ob_live_your_api_key_here' });
</script>
```

Pinned versions are available at `/obweb/v<version>/obweb.min.js`. The `latest` path tracks the newest release with a short cache.

## Where to initialize

Initialize as early as possible in your application lifecycle, once per page:

* **React / Next.js**: in your root layout or top-level client component, guarded so it runs once in the browser.
* **Vue / Nuxt**: in a client-side plugin.
* **Plain HTML**: in a `<head>` script, as shown above.

The SDK only runs in the browser. In server-rendered frameworks, make sure the init call executes client-side.

Recording starts immediately when `init` is called, before the network handshake with the Observerbee backend completes, so you do not lose the first moments of a session. See [Reliability](/sdk/reliability).

## Single-page applications

No router integration is needed. The SDK listens to the Navigation API where available and patches `history.pushState` / `replaceState` as a fallback, so client-side route changes are detected automatically and each route starts from a fresh DOM snapshot.

## App version tagging

Sessions can be tagged with your app's release version, which helps when comparing behavior across deploys. The SDK auto-detects a version from common conventions (Next.js and Nuxt build IDs, Sentry release globals, a `data-version` attribute on the obweb script tag, `<meta name="version">`, and common `window` globals such as `__APP_VERSION__`). To set it explicitly, pass `appVersion` in the [configuration](/sdk/configuration).
