# Add the messenger to your website

> Paste one snippet to put your AI agent on any website, with steps for popular site builders.

Source: https://askmavis.co/help/add-the-messenger-to-your-website  
Collection: Install your agent  
Last updated: 2026-12-05

The messenger is the chat widget your AI agent answers in. You add it to your website by pasting a short install code once.

![The Install tab of an AI agent, with the Enable widget button, the Website install code and steps for each website builder.](https://askmavis.co/help-media/add-the-messenger-to-your-website/overview.webp)

![Animation: on the Install tab the widget is enabled, the install code is copied and pasted into the footer code of a website builder and saved, then the launcher appears on the website and opens the messenger.](https://askmavis.co/help-media/add-the-messenger-to-your-website/install-flow.webp)

What the animation shows:

1. On **Install**, click **Enable widget**.
2. Copy the website install code.
3. Paste it into your site's footer code and save.
4. Open your website. The launcher appears, and clicking it opens the messenger.

## Before you start

- Your agent has some training content and you've tested it in the Playground.
- You can edit your website's code, or its site builder lets you add custom code.

## 1. Allow your website

1. Open your agent and go to **Guardrails**.
2. Under **Allowed domains**, type each website the widget may load on, for example `example.com`, and click **Add**. A note under the box shows how a pasted address will be saved.
3. Click **Save changes**.

The plain address and its `www` version count as the same site, so `example.com` covers `www.example.com`. You can paste a full page address: the path and port are ignored. Other subdomains such as `shop.example.com` need their own line, or `*.example.com` to cover them all. The widget won't load on sites that aren't listed.

## 2. Turn on the widget

Go to **Install** and click **Enable widget**. The button appears once you have saved an allowed domain. You can click **Take offline** at any time to hide it everywhere.

## 3. Paste the install code

Copy the **Website install code** from the **Install** tab. Paste it at the end of the body on every page where the messenger should appear, just before the closing `</body>` tag. It looks like this:

```html
<script src="https://mavis.help/messenger.js" referrerpolicy="strict-origin-when-cross-origin" async></script>
<script>
  window.AskMavisMessenger = window.AskMavisMessenger || [];
  window.AskMavisMessenger.push({
    messengerConfigId: "your-agent-id",
    consent: 'granted',
  });
</script>
```

Always copy the code from your own **Install** tab, since it contains your agent's ID. If your site has a Content Security Policy, allow `https://mavis.help`.

## Site builders

Under **Where to paste the code** on the **Install** tab, pick your website builder to see its steps.

**WordPress:** install a free header and footer code plugin, such as WPCode (Insert Headers and Footers). Open its **Header & Footer** settings, paste the code into the **Footer** box and save. Or add a **Custom HTML** block to your footer in **Appearance > Editor** and paste the code there.

**Wix:** open **Settings > Custom Code** and click **Add Custom Code**. Paste the code, choose **All pages**, **Load code once** and **Body - end**, then apply and publish. Wix needs a paid plan with a connected domain for this.

**Squarespace:** open **Code Injection** and paste the code into the footer, then save. It needs a plan that includes code injection.

**Shopify:** go to **Online Store > Themes**, open the **...** menu on your theme and choose **Edit code**. Open `layout/theme.liquid`, paste the code just before `</body>` and save.

**Webflow:** open **Site settings > Custom code**, paste the code into **Footer code** and save. Webflow needs a paid site plan for this.

**Google Tag Manager:** create a **Custom HTML** tag, paste the code, set the trigger to **All Pages**, then submit and publish the container.

## Check it works

Open your website in a new tab. The chat launcher appears in the corner. Ask it a question.

If it doesn't appear:

- Check your site's address is in **Allowed domains**. Whether you type `https://` doesn't matter, but a subdomain such as `shop.example.com` needs its own line or `*.example.com`.
- Check the widget is enabled on the **Install** tab.
- Check your country isn't in **Country blocking**.
- Clear your browser cache or try a private window.

## Related

- [Customise the messenger](https://askmavis.co/help/customise-the-messenger)
- [Share a chat page link](https://askmavis.co/help/shareable-chat-page)
- [Sign in your visitors](https://askmavis.co/help/identity-verification)
