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

# HelpAlive SDK: autocapture, identity, and Agent context

> The HelpAlive SDK is the browser script that auto-captures user behavior, ties activity to real users and workspaces, and powers the in-app AI Agent.

The HelpAlive SDK is a small browser script that does three things: auto-captures user behavior, ties activity to real users and workspaces, and feeds the AI Agent fresh page context whenever a user opens it. **One script tag, one `identify()` call, and you're done.**

## At a glance

|                         |                                                        |
| ----------------------- | ------------------------------------------------------ |
| **Where it runs**       | In your users' browsers, alongside your product        |
| **Effect on your page** | None — loads in the background, doesn't slow your site |
| **What you install**    | One script tag, or a single Google Tag Manager tag     |
| **What you write**      | One `identify()` call after login — nothing else       |
| **Browser support**     | Modern browsers (Chrome, Edge, Firefox, Safari)        |

## What the SDK does

<CardGroup cols={3}>
  <Card title="Autocapture" icon="zap">
    Clicks, pageviews, form submits, rage clicks, DOM errors — captured automatically with no tagging.
  </Card>

  <Card title="Identity" icon="user-check">
    `identify()` ties events to a stable user and workspace so analytics and Agent personalization are accurate.
  </Card>

  <Card title="Agent context" icon="message-circle">
    Feeds the in-app AI Agent fresh page context — what the user just clicked, where they got stuck — so it answers like someone who's actually watching.
  </Card>
</CardGroup>

## What's auto-captured

The SDK observes user behavior automatically — you don't write tracking code or maintain a tag plan. Every captured event is anonymized before transmission.

| Event          | What we capture                                                                                                                      |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| `pageview`     | Page loads, including in-app navigations (single-page apps work out of the box).                                                     |
| `click`        | Clicks on buttons, links, and other interactive elements. Element identifiers are anonymized; text content is redacted.              |
| `form_start`   | The user begins filling out a form. Useful for abandonment analysis.                                                                 |
| `form_submit`  | The user submits a form. (We never capture the field values.)                                                                        |
| `rage_click`   | Repeated clicks on the same element — a strong frustration signal.                                                                   |
| `scroll_depth` | How far a user scrolled on each page.                                                                                                |
| `dom_error`    | JavaScript errors and console errors that occurred while the user was interacting.                                                   |
| `exposure`     | A summary of which interactive elements were visible on the page. Helps the Agent know what's on screen when a user asks a question. |

## What's not captured

* **Keystrokes.** The SDK never logs what users type into inputs.
* **Form values.** Submit events fire; the values inside are never transmitted.
* **Password fields.** Always excluded.
* **Personal data** like emails, phone numbers, and national IDs. Removed in the browser before anything is sent, and again on our servers before anything is stored.

See [Privacy & redaction](/privacy/redaction) for the complete data model.

## The two calls you need to make

The SDK exposes a small surface on `window.HelpAlive`. The only methods you'll typically call yourself are:

### `HelpAlive.identify({ ... })` — required after login

Tells HelpAlive who the user is and which workspace they belong to. Without it, the SDK buffers events but nothing is sent.

```javascript theme={null}
HelpAlive.identify({
  userId:   user.id,           // required
  tenantId: tenant.id,         // required (use "default" if no workspaces)
  email:    user.email,
  plan:     user.plan
});
```

See [Identify](/sdk/identify) for the full field reference.

### `HelpAlive.setConsent(prefs)` — when you have a cookie banner

Pauses or resumes tracking based on the user's consent state.

```javascript theme={null}
HelpAlive.setConsent({ analytics: true, chat: true });
```

See [Consent](/sdk/consent) for the full setup.

That's it for the public surface most apps need. Everything else — buffering, flushing, real-time mode while the Agent is open, page-context handoff to the chatbot — happens automatically inside the SDK.

## Anonymous activity is dropped

Until you call `identify()`, the SDK doesn't send anything to our servers. If the user never logs in, the activity is forgotten when they leave the page. This keeps unauthenticated traffic out of your analytics, and keeps anonymous browsing out of HelpAlive entirely.

## Next steps

<CardGroup cols={2}>
  <Card title="Identify users" icon="user-check" href="/sdk/identify">
    The required call after authentication.
  </Card>

  <Card title="Configure consent" icon="shield-check" href="/sdk/consent">
    Pause tracking until your consent banner returns a decision.
  </Card>

  <Card title="Set up the Agent" icon="sparkles" href="/agent/overview">
    Train the AI assistant on your docs.
  </Card>

  <Card title="Privacy posture" icon="lock" href="/privacy/overview">
    What we capture, what we don't, where redaction happens.
  </Card>
</CardGroup>
