Widget Embed — Put Your Bot on Your Website
Widget Embed — Put Your Bot on Your Website
The Widget Embed page (Dashboard → Widget Embed) gives you the code that puts your bot on your site, plus controls to keep it secure. This guide covers everything on that page. For how the widget looks and behaves, see Chatbot Setup.
The Embed Code
At the top of the page is your embed snippet:
<script src="https://botaura.app/widget.js" data-business-id="YOUR_BUSINESS_ID"></script>
Click Copy Code and paste it into your website's HTML, just before the closing
</body> tag. The widget appears as a floating button (bottom-right by default; you can
move it to the left in Chatbot Setup). Your unique Business ID is shown at the bottom
of the page and is already filled into the snippet.
Test Before You Ship
Click Test Widget on This Page to inject the widget into the dashboard so you can open it and chat, without touching your website. Once you've confirmed it works, add the code to your live site.
Domain Whitelist
For security you can restrict which domains are allowed to load your widget. In the Domain Whitelist section:
- Type a domain (e.g.
mystore.com) and click Add Domain. - Each added domain is listed with the date it was added.
- Remove a domain with the trash icon — you'll be asked to confirm, because the widget will stop working on that domain immediately.
- Leave the list empty to allow the widget on any domain (the default).
- Subdomains of a whitelisted domain are allowed too.
- If you add domains and forget to include the one your site actually runs on, the widget won't load there — add it, and it works again within moments.
Platform-Specific Installation
Plain HTML
- Open your site's HTML file.
- Find the
</body>tag near the bottom. - Paste the embed code just above it and save.
WordPress
- Go to Appearance → Theme Editor.
- Select footer.php.
- Paste the code before
</body>and click Update File.
Prefer not to edit theme files? Use a plugin like "Insert Headers and Footers" and paste the code into the footer box. Note: if you run a WooCommerce store, you may not need the widget script at all — the native WooCommerce plugin can add the bot for you.
Shopify
- Go to Online Store → Themes.
- Click Actions → Edit code.
- Open theme.liquid and paste the code before
</body>, then Save.
Content Security Policy (CSP)
Only relevant if your website sets a Content Security Policy. A strict CSP will block
the widget from loading. Add https://botaura.app to these directives:
script-src ... https://botaura.app;
connect-src ... https://botaura.app;
frame-src ... https://botaura.app;
img-src ... https://botaura.app data:;
- script-src — loads the widget script (required)
- connect-src — widget API calls (token & settings)
- frame-src — the chat window iframe (use
child-srcon older browsers) - img-src — the widget button icon
Keep your existing sources and simply append https://botaura.app to each. Use the exact
domain (not a preview URL). If your browser console shows "violates the following Content Security Policy
directive", this is the fix.
How Sessions & Security Work
Each visitor gets a unique session; the conversation persists while the browser tab is open. The widget authenticates with a short-lived token that refreshes automatically, so visitors never see a login. The domain whitelist plus token auth mean your widget can't be embedded on sites you didn't approve. More in Security & Privacy.
Troubleshooting
- Widget doesn't appear — confirm the script is before
</body>, that your domain is whitelisted (or the list is empty), and that no CSP is blocking it. - CSP console error — apply the CSP directives above.
- Works locally but not live — the live domain must be whitelisted; local domains
like
localhostdon't need to be. - Something breaks only on certain browsers — check Dashboard → Widget Errors, where the widget logs JavaScript errors from visitors' browsers for debugging.
Related
- Chatbot Setup — customize the widget's look and personality
- Product Catalog — power product cards in chat
- Security & Privacy — how the widget stays safe
Was this helpful?
Related Articles
Knowledge Base — Train Your Bot
Your bot's intelligence comes entirely from your knowledge base. The more relevant content you add, the better it answers customer questions. This guide covers all three ways to train your bot and tips for getting the best results.
~4 min read
Chatbot Setup — Customize Your Chat Widget
Personalize your bot's name, avatar, tone, colors, chat bubbles, launcher button, and position. Preview and test before going live. Appearance customization is a Pro+ feature.
~7 min read
Lead Capture — Turn Visitors into Contacts
Botaura automatically identifies when a visitor is interested in your products or services and gently collects their contact information. No forms, no popups — just a natural conversation.
~3 min read