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

# Session

> The Session object returned by track().

## Properties

<ParamField path="session.score" type="number">
  Current attention score (0–100). Read-only.
</ParamField>

<ParamField path="session.status" type="'active' | 'idle' | 'dropped' | 'stopped'">
  Current session status.
</ParamField>

<ParamField path="session.id" type="string">
  Unique session ID (e.g. `sess_8xK2mP9q`).
</ParamField>

## Methods

### session.on(event, handler)

Subscribe to a session event. See [Events](/sdk/events) for all event types.

```ts theme={null}
session.on('score', ({ score }) => console.log(score))
session.on('drop', ({ score }) => showNudge())
session.on('stopped', () => cleanup())
```

### session.stop()

Stop the session, flush the final score to the ingest layer, and remove all event listeners.

```ts theme={null}
// On page unload
window.addEventListener('beforeunload', () => session.stop())
```

### session.pause() / session.resume()

Temporarily suspend signal collection without ending the session.

```ts theme={null}
session.pause()   // stop collecting signals
session.resume()  // restart signal collection
```
