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

# Getting Started

Add the Strada chat widget to your website by including the Web SDK script on your pages.

<Info>
  Need help with implementation? Contact your Strada team for guidance. Your development team is responsible
  for the final integration.
</Info>

## Script Tag

For all website pages where you want your chat widget to appear, paste the following code within the `<head></head>` tags. Replace `<YOUR-ORGANIZATION-ID>` and `<YOUR-AGENT-ID>` with your organization and agent IDs.

```html theme={null}
<script>
  window.stradaSettings = {
    organizationId: '<YOUR-ORGANIZATION-ID>',
    agentId: '<YOUR-AGENT-ID>'
  };
</script>
<script src="https://sdk.getstrada.com/web-sdk/latest/strada-chat.js"></script>
```

<Note>You can find your Organization ID and Agent ID in the Strada dashboard.</Note>

## That's it!

You should now see a small chat button on the bottom right corner of your website. Click the button to open the chat widget.

<Check>
  The Strada Web SDK also supports a rich set of actions and settings that you can use to customize the
  behavior of your widget. For example, you might want to delay the launch of your widget until a certain
  event, pass user metadata, or authenticate users. The [Web SDK reference](/sdks/web/sdk-api-reference)
  covers all of these options and more.
</Check>

## Testing Mode

To test your chat widget, you can set the `debug` property to `true` in the `metadata` object. This will mark the chat as a test chat and it will be included in the test chats list.

```html theme={null}
<script>
  window.stradaSettings = {
    organizationId: '<YOUR-ORGANIZATION-ID>',
    agentId: '<YOUR-AGENT-ID>',
    metadata: {
      debug: true
    }
  };
</script>
```

## Delay Widget Loading

To defer widget initialization until a specific event occurs, enable lazy mode by setting the `lazy` property to `true`:

```html theme={null}
<script>
  window.stradaSettings = {
    organizationId: '<YOUR-ORGANIZATION-ID>',
    agentId: '<YOUR-AGENT-ID>',
    lazy: true
  };
</script>
<script src="https://sdk.getstrada.com/web-sdk/latest/strada-chat.js"></script>
```

With lazy mode enabled, manually initialize the SDK by calling `window.stradaChat.start()`. Any setting normally configured in `window.stradaSettings` can be passed here:

```javascript theme={null}
window.stradaChat.start({
  organizationId: 'your-org-id',
  agentId: 'your-agent-id',
  metadata: {
    userId: '12345',
    accountType: 'premium'
  }
});
```

## Pass User Data

Use `metadata` to pass information about a user to Strada for attribution and analytics purposes. This data is not accessible to the AI agent during conversations.

```html theme={null}
<script>
  window.stradaSettings = {
    organizationId: '<YOUR-ORGANIZATION-ID>',
    agentId: '<YOUR-AGENT-ID>',
    metadata: {
      userId: '12345',
      accountType: 'premium',
      signupDate: '2024-01-15'
    }
  };
</script>
<script src="https://sdk.getstrada.com/web-sdk/latest/strada-chat.js"></script>
```

To change these values after the widget has been initialized, pass them to the [open()](/sdks/web/sdk-api-reference#open) action.

<Note>Meta field keys should not include whitespace, emojis, or special characters.</Note>

## Pass Agent Variables

Use `agentVariables` to inject information into your agent's chat conversations. Unlike `metadata`, these variables are accessible to the AI agent and can be used to customize agent behavior, provide context, or personalize the conversation experience.

```html theme={null}
<script>
  window.stradaSettings = {
    organizationId: '<YOUR-ORGANIZATION-ID>',
    agentId: '<YOUR-AGENT-ID>',
    agentVariables: {
      first_name: 'John',
      last_name: 'Doe',
      email: 'john@example.com'
    }
  };
</script>
<script src="https://sdk.getstrada.com/web-sdk/latest/strada-chat.js"></script>
```

## User Authentication

Implement secure user verification by providing a `getUserToken` function that returns a JWT token. This establishes an authenticated identity for each chat session.

```html theme={null}
<script>
  window.stradaSettings = {
    organizationId: '<YOUR-ORGANIZATION-ID>',
    agentId: '<YOUR-AGENT-ID>',
    getUserToken: async () => {
      // Make a request to your API to get a fresh JWT token
      const response = await fetch('/api/strada-token');
      const { token } = await response.json();
      return token;
    }
  };
</script>
<script src="https://sdk.getstrada.com/web-sdk/latest/strada-chat.js"></script>
```

<Info>
  The `getUserToken` function should return a Promise that resolves to a JWT token string, or `null` if
  authentication should be skipped.
</Info>

## Hide the Floating Button

The widget displays a floating button by default. To manage chat visibility through your own UI elements instead, set `hideButton` to `true`:

```html theme={null}
<script>
  window.stradaSettings = {
    organizationId: '<YOUR-ORGANIZATION-ID>',
    agentId: '<YOUR-AGENT-ID>',
    hideButton: true
  };
</script>
<script src="https://sdk.getstrada.com/web-sdk/latest/strada-chat.js"></script>
```

Then use the [open](/sdks/web/sdk-api-reference#open) action to open the chat programmatically:

```javascript theme={null}
// Open the chat when user clicks a custom button
document.getElementById('my-chat-button').addEventListener('click', () => {
  window.stradaChat.open();
});
```

## Mount Widget in a Custom Container

By default, the widget mounts to `document.body` and appears as a floating overlay (bottom-right). To embed it inside a specific part of your layout—for example, a sidebar or a dedicated chat panel—use `parentElement` with a CSS selector:

```html theme={null}
<div id="chat-container" style="position: relative; width: 100%; height: 500px; padding: 0; margin: 0;"></div>

<script>
  window.stradaSettings = {
    organizationId: '<YOUR-ORGANIZATION-ID>',
    agentId: '<YOUR-AGENT-ID>',
    parentElement: '#chat-container',
    hideButton: true
  };
</script>
<script src="https://sdk.getstrada.com/web-sdk/latest/strada-chat.js"></script>
```

The container must have `position: relative` and no padding or margin so the widget can fill it. Use `hideButton: true` and call `stradaChat.open()` from your own UI (e.g. a tab or button) to show the chat. See the [parentElement](/sdks/web/sdk-api-reference#parentelement) API reference for full details.
