Embed AI Chatbot with JavaScript
One script tag to add AI chat to any website
Vatdi provides a lightweight JavaScript embed that adds your trained AI chatbot to any website in under two minutes. Copy a single script tag into your HTML, and the fully branded chat widget loads asynchronously without impacting page performance or Core Web Vitals.
How It Works
Copy Your Embed Code
Go to your Vatdi dashboard, select the chatbot, and click "Get Embed Code." Copy the generated script tag.
Paste Into Your Website
Add the script tag before the closing </body> tag in your HTML. For CMS platforms, use the header/footer injection feature.
Verify and Customize
Reload your website to see the chat widget. Use data attributes or the JavaScript API to customize behavior as needed.
Async Loading for Zero Impact
The Vatdi script loads asynchronously with defer. It does not block page rendering, does not affect your Largest Contentful Paint, and adds less than 40 KB to initial payload. The widget initializes only after the page is fully interactive.
Configuration via Data Attributes
Customize the widget behavior directly from the script tag using data attributes. Set the chatbot ID, initial message, position, theme, language, and more without writing any additional JavaScript code.
Programmatic Control
Access the Vatdi JavaScript API to open, close, or toggle the widget programmatically. Trigger conversations from buttons, links, or page events. Pass visitor metadata and custom attributes for context-aware responses.
Frequently Asked Questions
No. The script loads asynchronously and adds less than 40 KB to your page. It does not affect Core Web Vitals or page load speed.
Yes. Add the script to your global layout or template and it will appear on every page. You can also restrict it to specific pages using configuration.
Yes. Paste the script in your theme header or use a Vatdi WordPress plugin for one-click installation.
Yes. Use the JavaScript API window.Vatdi.open() to trigger the chat widget from any button, link, or page event.
Yes. The script URL includes a major version. Minor updates are applied automatically. Breaking changes only occur on major version bumps with advance notice.
Embed Your Chatbot in Two Minutes
One line of JavaScript. Zero impact on page speed.