# Deploy and customize the web widget

> Add your agent's chat widget to your website with a code snippet or Google Tag Manager, then set how it looks and behaves.

- Source: https://www.aui.io/help/deploying/deploy-the-web-widget
- Section: Deploying
- Last updated: November 23, 2026

The web widget is a chat window that visitors open from a button on your website. It answers with your agent's live commit. You add it to your site once: changes to the agent reach the widget when you make a new commit live, and changes to how it looks and behaves reach it when you save them in [Web Widget Settings](#customize-the-widget), with no change to your site's code.

## Before you start

- A live commit. See [Make a commit live, lock a branch, and roll back](https://www.aui.io/help/branches/make-a-commit-live).
- A **Client API key** for this agent. Create one under **Organization** > **API Keys** > **Client API Keys**; see [API keys](https://www.aui.io/help/deploying/api-keys). Client API keys are made for web pages, so it's expected that this key appears in your site's code.
- Access to edit your site's HTML, or to add tags in Google Tag Manager.

## Add it with a code snippet

1. In the side rail, open **Deployment** > **Deploy web-widget**.
2. Select the **Deploy by code snippet** tab.
3. Under **Insert the module script**, click **Copy** and paste the script right before the closing `</head>` tag of your pages.
4. Under **Add the widget root to your body**, click **Copy** and paste the tag anywhere inside `<body>`.
5. Under **Initialize the widget**, click **Copy** and paste the script right before the closing `</body>` tag.
6. In the script you pasted, replace `your-publishable-key` with your Client API key.
7. Update your site with the changed pages and open one of them. The widget's button appears in the corner.

Copy the code from the page rather than retyping it. The initialization script is where the key goes:

```html
<script>
  window.addEventListener('DOMContentLoaded', () => {
    window.auiSettings.init({
      apiKey: 'your-publishable-key',
    });
  });
</script>
```

![Dark mode, ACME Air Rebooking Agent. The Deploy Agent page with the Deploy by code snippet tab selected beside Deploy by GTM. Step 1, Insert the module script, is open with an HTML code block and a Copy button; step 2, Add the widget root to your body, and step 3, Initialize the widget, are collapsed. On the right, a Customize box links to Widget settings and a Need help? box links to the Quickstart guide.](https://www.aui.io/assets/help/deploying/deploy-the-web-widget/code-snippet-tab.png)

*Three pieces of code, each with its own Copy button.*

## Add it with Google Tag Manager

1. Open **Deployment** > **Deploy web-widget** and select the **Deploy by GTM** tab.
2. Under **Prepare the widget code**, copy the three pieces: the **Module script**, the **Custom HTML tag for body** and the **Initialization script**. Replace `your-publishable-key` in the initialization script with your Client API key.
3. In Google Tag Manager, create a tag of type Custom HTML and paste the module script. Trigger it on all pages, or on the pages where the widget should load.
4. Create a second Custom HTML tag with the custom HTML tag for the body.
5. Create a third Custom HTML tag with the initialization script, with the same trigger as the others.
6. Submit your changes in Google Tag Manager so they reach your site. Name the change after the widget, so it's easy to find later.
7. Visit your site to check that the widget appears. Use Google Tag Manager's Preview mode to confirm the tags fire.

The **Deploy by GTM** tab repeats these steps, with a link to Google's own setup guide.

## If the widget doesn't appear

- Check that the key in the initialization script is a Client API key for this agent, and that its status is active on the **Client API Keys** page.
- Check that all three pieces are on the page, with the module script in the `<head>`.
- Check that the agent has a live commit.
- Look for errors in the browser's console.

## Customize the widget

Open **Deployment** > **Web Widget Settings** in the side rail to set how one agent's widget looks and behaves. Your website picks up saved changes on its own.

The page has four tabs on the left (**Appearance**, **Behavior**, **Follow-ups** and **Advanced**), the settings in the middle, and a **Live preview** of the widget on the right. The preview needs a Client API key for the agent. Without one, it says the widget can't load and links to where you add a key.

The **Ready to go live?** box on the left links to **Deploy widget**, the code for your site described above. If you have unsaved changes, it reminds you to save first.

![Dark mode, ACME Air Rebooking Agent. The Web Widget Settings page with Appearance selected in the left list beside Behavior, Follow-ups and Advanced. The Widget section is open with Position set to Bottom right and Font set to Inter; Launcher, Header, Chat panel and Footer are collapsed below it. The right side says the widget cannot load until an API key is added, and the Discard and Save buttons at the bottom are dimmed.](https://www.aui.io/assets/help/deploying/deploy-the-web-widget/appearance-tab.png)

*Appearance settings are grouped in sections you open one at a time.*

### Save or discard

Changed fields are marked, and the bar at the bottom counts them, for example "2 unsaved changes". Click **Save** to apply them to the widget on your website, or **Discard** to return to the saved settings. Your website always shows the saved settings.

### Appearance

The **Appearance** tab has five sections:

| Section | What you set |
|---|---|
| **Widget** | **Position** on the page (**Bottom right**, **Bottom left**, **Top right** or **Top left**) and **Font**. |
| **Launcher** | The button visitors click to open the widget: its **Style** (**Image and Text**, **Image + arrow** or **Icon**), its image or icon, its text, and its colors. |
| **Header** | **Header style** (**Agent name and image** or **Company logo**), the **Agent name** and **Agent image**, or the **Logo** and **Logo alignment**, the header colors, and the **Close widget icon** (**Chevron**, **Straight line** or **Close (X)**). |
| **Chat panel** | The colors of the agent's and the visitor's messages, and of their text. |
| **Footer** | The message box's **Placeholder** text, **Send button background** and **Send icon color**. |

The **Header** section also has four switches:

- **Allow close chat** shows the close button in the widget's header.
- **Allow new chat** lets visitors start a fresh conversation from the header.
- **New-chat confirmation** asks visitors to confirm before starting a new chat.
- **Show online status** shows "Online" under the agent's name. It isn't available with the **Company logo** header style.

### Behavior

Under **General**:

- **Enable new message sound** plays a sound when a new message from the agent arrives.
- **Allow transcript download** lets visitors download the conversation from the widget header's menu.

Some options on this tab, such as partial mode, swipe and the default state on desktop and mobile, aren't available yet and appear dimmed.

### Follow-ups

**Suggestion colors** sets the **Text**, **Background** and **Border** colors of the follow-up suggestion chips the widget shows.

### Advanced

**Agent variables** is a code editor for JavaScript that passes agent variables with the widget's conversations, such as the ID of the customer signed in to your site. The editor checks the code as you type, and **Code contains syntax errors** blocks saving until you fix it.

The agent only uses variables its program declares. See [Agent variables and test callers](https://www.aui.io/help/testing/agent-variables-and-test-callers), and [agent variables](https://docs.aui.io/api/messaging/send-messages) in the developer docs.
