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

# Events and Sessions

Track page views, custom events, session data, consent, and cross-tab conversation continuity.

# Events and Sessions

The widget can capture visitor context, keep active conversations available across tabs, and send product events that help support agents understand what happened before a message.

## Page Events

For single-page apps, send page events when routing changes.

```js
RogerIQ("event", {
  type: "page-viewed",
  url: window.location.href,
  title: document.title,
  source: "app-router"
});
```

## Custom Tracking

```js
RogerIQ("track", "Checkout failed", {
  orderId: "ord_123",
  step: "payment"
});
```

## Session Data

Session data is string key-value context available during the current visitor session.

```js
RogerIQ("session-data", {
  plan: "pro",
  tenant: "acme",
  region: "us-east"
});
```

## Consent

```js
RogerIQ("consent", { analytics: "granted", persist: true });
RogerIQ("consent", { analytics: "denied", persist: true });
RogerIQ("consent", null);
```

## Cross-Tab Session Handoff

RogerIQ stores active conversation session data in local storage and broadcasts updates across tabs. That lets a returning visitor continue the same active conversation from another tab.

## Useful Events

| Event | Payload |
| --- | --- |
| `ready` | Widget loaded. |
| `open`, `close` | Launcher visibility changed. |
| `route-changed` | Widget route changed. |
| `chat-started`, `chat-ended` | Chat lifecycle changed. |
| `message-received` | New agent, AI, or system message received. |
| `csat-submitted` | Visitor submitted a satisfaction score. |
| `identity-updated` | Contact identity was accepted or rejected. |
| `connection-status` | Realtime connection changed. |