Embed the widget
Add one script tag to your site and your AI assistant appears as a floating chat button. This guide walks you through embedding, allowed domains, and what to expect when it goes live.
Adding the widget to your website takes one line of HTML. Once it's live, visitors get a floating chat button that opens your AI assistant in a popup — no page reload, no friction.
Embed in three steps
1. Open your bot's Widget settings
In the dashboard, go to your bot → Widget tab. Customize the color, avatar, and starter message to match your brand, then save.
2. Copy the embed snippet
The Widget tab shows a ready-to-use <script> tag with your bot ID already filled in. Click Copy.
3. Paste it before </body>
Add the snippet to every page where you want the widget to appear. The defer attribute means it won't block page load.
<script src="https://app.askanydocs.com/widget/BOT_ID.js" defer></script>
Tip: The exact snippet with your real bot ID is always available in the Widget settings page — no need to copy it from here.
Allowed domains
The widget only works on origins you explicitly approve. This prevents your bot from being embedded on sites you don't control.
Configure allowed domains in the bot settings before going live. If a request comes from an unlisted origin, the chat returns 403 and the widget stays hidden.
Important: If you embed the script before adding your domain to the allowed list, visitors will see no widget — the script loads but the chat is silently blocked.
Escalation responses
When the bot cannot confidently answer, it returns a response together with a structured escalation object. The widget automatically renders a support call-to-action so the visitor can reach a human without leaving the page.
Set a fallback URL in the Widget settings (for example a support email or live chat link) so the escalation button has somewhere useful to send visitors.
Session behavior
The widget tracks the current conversation in the visitor's browser session. If the session expires or the visitor returns after a long break, a new conversation starts automatically — no stale context, no errors.
Related articles
Getting started
Start here to understand how AskAnyDocs works and what you need before creating your first bot.
Create your first bot
Follow the bot creation wizard from company setup through resources and preview.
Add website and documents
Learn how AskAnyDocs ingests website pages and document files and how to choose the right resource type.