# Put it on your site

> Turn on the chat widget, paste one line into your website and choose whether a flow answers first.

The chat widget is a button in the corner of your website that opens a conversation with your agent. Visitors don't sign in, and what they write shows up in your Inbox like any other conversation.



## Turn the widget on

1. Open the agent and go to its **Channels** tab.
2. Under **Embed on your site**, switch on **Allow the public chat widget**.
3. Press **Copy embed code**. **Preview the widget** opens it on a blank page first, if you want to see it.



> [!IMPORTANT]
> The widget is public: anyone who opens your site can write to the agent. Its **Token budget** and **Messages per minute** (in **Configure**) are what keep spending in check, so set them before you go live.

## Paste the code into your site

The code is a single `<script>` tag. Paste it into every page where the chat should appear, just before the closing `</body>` tag. Most site builders have a place for this, usually called "custom code", "footer code" or "scripts".

The widget speaks the language set in the code (`en`, `pt` or `es`: the one you use the console in). Change it there, or remove that attribute and the widget follows your page's own `<html lang>`.

## Let a flow answer first (optional)

Out of the box the agent answers the widget, unless a live flow's [trigger](https://nomongeta.zenhalab.com/www/nomongeta/en/docs/flow-builder/triggers) matches the message. To have a [flow](https://nomongeta.zenhalab.com/www/nomongeta/en/docs/concepts/flows-and-agents) greet visitors with a menu, take a booking or collect a lead first:

1. Go to **Channels** and press **Add channel**.
2. Choose **Website chat**, pick the agent under **Answers with** and the flow under **Flow**.
3. Press **Connect**. From now on the flow answers the widget: every message that no run is waiting for and no trigger takes starts it at its start step. The agent no longer replies on its own there; where it should handle open questions, give the flow an [AI step](https://nomongeta.zenhalab.com/www/nomongeta/en/docs/flow-builder/ai-agent).

The flow has to be published before it answers; until then, or while it's paused, the agent does. See [Flows and agents](https://nomongeta.zenhalab.com/www/nomongeta/en/docs/concepts/flows-and-agents) for who answers what.

## Turn it off

Switch **Allow the public chat widget** off and the agent stops answering on your site, even where the code is still pasted. Conversations so far are kept. Pausing the agent (Pause at the top of its page) stops it on every channel.

## Learn more

[Website chat](https://nomongeta.zenhalab.com/www/nomongeta/en/docs/channels/website-widget) covers what visitors see, keeping the widget safe, and the [widget reference](https://nomongeta.zenhalab.com/www/nomongeta/en/docs/developers/widget) for developers.
