Documentation
Installation
Script tag (recommended)
The fastest way to get started. Paste this snippet before the closing </body> tag on every page where you want the widget to appear.
index.html
<!-- Paste before </body> -->
<script>
(function(w,d,s,o){
var j=d.createElement(s);j.async=true;
j.src='https://widget.bx-livechat.com/bxlivechat.js';
j.onload=function(){w.BXLivechat.boot({orgId:o})};
d.head.appendChild(j);
})(window,document,'script','YOUR_ORG_ID');
</script>npm package
If you prefer managing dependencies through npm:
Terminal
npm install @bxlivechat/widgetReact / Next.js
Wrap the widget in a React component for proper lifecycle management. The component loads the script on mount and cleans up on unmount.
components/live-chat-widget.tsx
"use client";
import { useEffect } from "react";
export function LiveChatWidget({ orgId }: { orgId: string }) {
useEffect(() => {
const script = document.createElement("script");
script.src = "https://widget.bx-livechat.com/bxlivechat.js";
script.async = true;
script.onload = () => {
window.BXLivechat.boot({ orgId });
};
document.head.appendChild(script);
return () => {
window.BXLivechat?.destroy();
script.remove();
};
}, [orgId]);
return null;
}WordPress
Two options for WordPress sites:
- Plugin: Install the BXLivechat plugin from the WordPress plugin directory and enter your Org ID in the settings page.
- Manual: Go to Appearance → Theme File Editor, open
header.php, and paste the script tag snippet before</head>.
Google Tag Manager
- Open your GTM container and click Add a new tag.
- Choose Custom HTML as the tag type.
- Paste the script tag snippet into the HTML field.
- Set the trigger to All Pages (or specific pages).
- Save and publish the container.
SPA frameworks
For single-page apps (Vue, Angular, Svelte, etc.), call window.BXLivechat.boot() after each client-side route change to re-initialize the widget if needed.
router.js
// After each client-side route change
window.BXLivechat.boot({ orgId: "YOUR_ORG_ID" });Configuration options
Pass these options to BXLivechat.boot():
| Parameter | Type | Description |
|---|---|---|
orgId* | string | Your organization ID from the admin panel. |
visitor | object | Pre-fill visitor data (name, email, phone) to skip the pre-chat form. |
customData | object | Arbitrary key-value pairs visible to agents in the chat sidebar. |
language | string= "auto" | Widget UI language. Supported: en, th, zh, ja, ko, pt. Defaults to auto-detect from the browser. |
Content Security Policy
If your site uses a Content Security Policy, add
widget.bx-livechat.com to both the script-src and connect-src directives.