Widget Embedding
Add your AI chatbot to any website in seconds with our simple embed code.
Quick Start
Add this code before the closing </body> tag:
<script
src="https://www.chatreact.ai/embed/widget.js"
data-chatbot-id="YOUR_CHATBOT_ID"
async
></script>
That's it! Your chatbot is now live on your website.
Finding Your Chatbot ID
- Go to your chatbot's settings
- Navigate to the Embed tab
- Copy the embed code (includes your ID)
The chatbot ID in the embed code is not the same as the name in your dashboard URL. Always copy the ID from the Embed tab.
Customizing the Widget
The widget's look and behavior are configured in your dashboard — not in the embed code. Go to Dashboard → Chatbots → [your chatbot] → Widget to adjust:
- Position — bottom-right, bottom-left, or inline
- Colors — primary, background and text colors, plus border radius
- Size — widget width and height
To open the chat automatically after a configurable delay, enable Auto-Open in the Behavior tab of the same settings page.
Changes apply to your website automatically — no need to update the embed code. See the Widget Customization guide for all available options.
The widget language is detected automatically from each visitor's browser, based on the languages you enable in your chatbot's Languages tab.
Choose the Inline position to embed the chat directly into the page at the spot where the script tag is placed. The widget is always open, with no bubble or close button — ideal for dedicated chat pages or support sections.
FAQ Widget
Display FAQs as an accordion on any page:
<div id="chatreact-faq"></div>
<script
src="https://www.chatreact.ai/embed/faq-widget.js"
data-chatbot-id="YOUR_CHATBOT_ID"
async
></script>
The FAQ widget shows published FAQs from your chatbot. Colors and styling (primary, background and text colors, border radius) are configured in Dashboard → FAQs → Settings.
FAQ Widget Options
| Setting | Description | Where to Configure |
|---|---|---|
| Colors & Styling | Primary, background and text colors, border radius | Dashboard → FAQs → Settings |
| Width | Choose between 100% (full width) or a custom pixel width (400–1200px) | Dashboard → FAQs → Settings |
| Sort Order | Display order: Date (newest first), Name (alphabetical), or Custom (manual drag & drop) | Dashboard → FAQs → Settings → Behavior |
| Category Filter | Show only specific categories in the widget | Embed code data-categories attribute |
| Custom Container | Render the widget inside your own element instead of the default chatreact-faq div | Embed code data-container attribute |
| Language | Override the widget language (defaults to your page's <html lang> attribute, then the visitor's browser language) | Embed code data-lang attribute |
Category Filter Example
<script
src="https://www.chatreact.ai/embed/faq-widget.js"
data-chatbot-id="YOUR_CHATBOT_ID"
data-categories="shipping,returns"
async
></script>
When the widget is filtered to a single category, that category's own sort order (set in Dashboard → FAQs → Categories) overrides the global sort setting.
Mobile Optimization
The chat widget is fully optimized for mobile devices:
- Full-width layout on small screens
- Slide-up animation when opening
- iOS keyboard handling (widget adjusts to on-screen keyboard)
- Safe-area support for iPhone notch and home indicator
- Larger touch targets for better usability
- Input font size prevents iOS auto-zoom
Platform-Specific Guides
WordPress
Recommended: Use the official ChatReact WordPress Plugin for the easiest integration with Gutenberg blocks, Elementor widgets, and shortcodes.
Alternative: Manual embed via a "Header/Footer Scripts" plugin:
- Install any "Header/Footer Scripts" plugin
- Add the embed code to the footer section
- Save and publish
Shopify
Recommended: ChatReact Shopify App
Install the ChatReact app from the Shopify App Store for the easiest integration:
- Install the ChatReact app in your Shopify admin
- Enter your Chatbot ID in the app settings
- The chat widget automatically appears on your storefront
- Manage widget assignments per page, or enable it everywhere
The app also supports Form and FAQ widgets as App Blocks in the Theme Editor.
Alternative: Manual Embed
- Go to Online Store → Themes → Edit Code
- Open
theme.liquid - Add code before
</body> - Save
Webflow
- Go to Project Settings → Custom Code
- Add to Footer Code
- Publish site
Next.js / React
Use the Script component:
import Script from 'next/script';
export default function Layout({ children }) {
return (
<>
{children}
<Script
src="https://www.chatreact.ai/embed/widget.js"
data-chatbot-id="YOUR_CHATBOT_ID"
strategy="lazyOnload"
/>
</>
);
}
Vue.js
Add to your main App.vue or layout:
<script setup>
import { onMounted } from 'vue';
onMounted(() => {
const script = document.createElement('script');
script.src = 'https://www.chatreact.ai/embed/widget.js';
script.dataset.chatbotId = 'YOUR_CHATBOT_ID';
script.async = true;
document.body.appendChild(script);
});
</script>
JavaScript API
Interact with the widget programmatically:
// Open the chat
ChatReact.open();
// Close the chat
ChatReact.close();
// Toggle open/closed
ChatReact.toggle();
// Start a fresh conversation
ChatReact.newChat();
// Remove the widget from the page entirely
// (useful in single-page apps, e.g. on route changes)
ChatReact.destroy();
Testing
Preview Mode
Before embedding live:
- Use the Preview feature in your dashboard
- Test different scenarios
- Verify responses are accurate
Testing on a local development site? Use the standard embed code unchanged — it works on localhost pages too.
Troubleshooting
Widget Not Appearing
- Check browser console for errors
- Verify chatbot ID is correct
- Ensure chatbot is active (not disabled)
- Check if ad blockers are interfering
- Check your plan usage — the widget pauses when your plan's monthly limit is reached
Caching & Optimization Plugins
Some caching or script-optimization plugins rewrite script URLs, which can stop the widget from loading. If that happens, add an explicit API URL to the script tag:
<script
src="https://www.chatreact.ai/embed/widget.js"
data-chatbot-id="YOUR_CHATBOT_ID"
data-api-url="https://www.chatreact.ai"
async
></script>
The same attribute works on the FAQ and form widget scripts.
Styling Conflicts
If your site's CSS conflicts:
- The widget scopes its styles to its own container and uses high-priority rules to resist conflicts
- Check z-index values of elements overlapping the widget
- Avoid broad
!importantrules in your site CSS that target generic elements
Performance
The widget is designed for minimal impact:
- Loads asynchronously — never blocks your page render
- Lightweight: roughly 30 KB compressed transfer
Next Steps
- Widget Customization →
- WordPress Plugin →
- Shopify Integration →
- FAQ Management →
- Smart Contact Forms → — embed standalone forms with the form widget