Website Embed
Chat Widget embed: add the chatbot to any website
Embed the Assistrio chat widget with one script tag. Copy-paste install code for HTML, React, Next.js, WordPress, Shopify, Webflow, and more.
The Chat Widget is a launcher button in the corner of your site that opens a chat panel. On phones the open panel goes full screen. The widget renders inside a Shadow DOM, so your site's CSS won't change how it looks and its CSS won't leak into your page.
Install code
Open your agent, click Deploy in the top bar, choose Chat Widget, and click Copy Snippet. It looks like this:
<link rel="stylesheet" href="https://widget.assistrio.com/assistrio-chat.css" />
<script>
window.AssistrioChatConfig = {
agentId: "YOUR_AGENT_ID",
apiBaseUrl: "https://chat.assistrio.com",
position: "right"
};
</script>
<script src="https://widget.assistrio.com/assistrio-chat.js" async></script>- 1
Put the stylesheet in <head>
Add the
<link>tag inside your page's<head>. - 2
Put the scripts before </body>
Add both
<script>tags just before the closing</body>tag, in the same order. - 3
Load it once per page
Add it to your site-wide layout or template so it's on every page — and only once. Don't load it again on each client-side route change.
- 4
Add your website to Allowed websites
In the agent's deploy settings, add the website where you installed the code. See Allowed websites.
React and Next.js
In Next.js, keep the <link> in your root layout's <head> and turn each <script> into a next/script <Script> with strategy="afterInteractive" — the inline one needs an id and its code as children.
import Script from "next/script";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<head>
<link rel="stylesheet" href="https://widget.assistrio.com/assistrio-chat.css" />
</head>
<body>
{children}
<Script id="assistrio-config" strategy="afterInteractive">
{`window.AssistrioChatConfig = {
agentId: "YOUR_AGENT_ID",
apiBaseUrl: "https://chat.assistrio.com",
position: "right"
};`}
</Script>
<Script src="https://widget.assistrio.com/assistrio-chat.js" strategy="afterInteractive" />
</body>
</html>
);
}In a plain React (Vite, Create React App) project, paste the snippet into index.html.
Website builders
- WordPress — install the free WPCode plugin, open Code Snippets › Header & Footer, and paste the snippet into the footer box.
- Shopify — Online Store › Themes › Edit code ›
theme.liquid, and paste it before</body>. - Webflow, Squarespace, Wix, Framer — paste it into the site-wide custom code (footer) setting.
Install with AI
Using Lovable, Bolt, v0, Cursor, or Claude Code? The Install with AI button on the Deploy page gives you a ready prompt for your tool that adds the code in the right place.
Launcher position
Set position to "right" (default) or "left". With any other value the chat doesn't load, and the reason is logged as an [Assistrio Chat] warning in the browser console. Colors, avatar, welcome message, and other appearance settings come from the dashboard, so you can change them in the Playground without editing your site.
Troubleshooting
- Nothing appears — check the browser console for an
[Assistrio Chat]warning, such as a missingagentIdorapiBaseUrl. Visitors never see an error card for a broken install code — the chat is just hidden. Make sure both scripts are present and the Chat Widget is live. - “This website isn't allowed” — add the exact website (including a subdomain) to Allowed websites, and check it's turned on.
- Two launchers — the snippet was added twice, for example in a theme and in a plugin. Remove one.
- See also the Help center FAQ.
Was this page helpful?
Need help? Contact support — we reply within one to two business days.
