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

# Embed on Your Website

> Put your bot live on your site with a single script tag, and learn where to paste it.

Putting your bot live takes one line of code. You copy a script tag from the
**Deploy** page and paste it into your site. The chat bubble then appears on
every page automatically – no plugin, no developer needed.

## Add the script tag

<Steps>
  <Step title="Open the Deploy page" icon="rocket">
    In your bot's dashboard, open the **Deploy** page. You'll see a
    ready-to-use script tag with your bot's key already filled in.
  </Step>

  <Step title="Copy your script" icon="copy">
    Click **Copy** to put the snippet on your clipboard. It looks like this:

    ```html theme={null}
    <script src="https://widget.chatref.ai/loader.js?apiKey=YOUR_API_KEY" async></script>
    ```

    Your real `apiKey` is already in the snippet on the Deploy page – the one
    above just shows the shape. It loads your bot.
  </Step>

  <Step title="Paste it before </head>" icon="code">
    Paste the script into your site's HTML, just before the closing `</head>`
    tag. The `async` attribute keeps your page fast – the bot loads in the
    background.
  </Step>

  <Step title="Publish your site" icon="globe">
    Save and publish. The bubble now shows on every page. The first time the
    widget loads on your live site, your bot is marked as **deployed**.
  </Step>
</Steps>

<Note>
  Tested your bot but haven't embedded it yet? Chatref sends you a friendly
  reminder email with the snippet, so the code is always one click away when
  you're ready to go live.
</Note>

## Where to paste it

You only paste the script once. Where it goes depends on your site builder, but
the rule is the same everywhere – put it in the page `<head>` (or a "header
scripts" / "custom code" box) so it loads on every page.

| Platform             | Where to paste                                                                            |
| -------------------- | ----------------------------------------------------------------------------------------- |
| **WordPress**        | Your theme's header, or a header-scripts plugin (e.g. a "headers and footers" plugin)     |
| **Shopify**          | **Online Store → Themes → Edit code**, then paste into `theme.liquid` inside the `<head>` |
| **Webflow / Framer** | Site-wide custom code, in the **Head** section of your project settings                   |
| **Plain HTML**       | Directly in your HTML file, just before `</head>`                                         |

<Tip>
  If your builder only offers a single "custom code" box, paste the script there.
  Site-wide head code is what makes the bot appear on every page at once.
</Tip>

## Rotating your key

If your key is ever shared by mistake, you can rotate it from the **Deploy**
page. Rotating creates a **new key** and disables the **old one** right away.

<Warning>
  After you rotate, your old snippet stops working. Update the script tag
  **everywhere you pasted it** – every site, theme, or page – with the new key,
  or the bot will stop loading there.
</Warning>

## Next steps

<CardGroup cols={2}>
  <Card title="Run several bots from one script" icon="robot" href="/deploy/multi-agent-routing">
    Use one workspace script to show different agents on different pages.
  </Card>

  <Card title="Lock the widget to your sites" icon="shield" href="/deploy/allowed-domains">
    Allow only your own domains to load the widget.
  </Card>
</CardGroup>
