Web widget installation
Add the Liya live chat and AI widget to your website or web app in under 5 minutes.
Choose your installation method
Option A: Script tag (any website)
Paste the following snippet before the closing </body> tag on every page where you want the widget to appear. Replace YOUR_WORKSPACE_ID with the ID from Settings → AI Agent → Widget.
workspaceId in Dashboard → AI Agent → Installation. It looks like ws_a1b2c3d4e5f6.Option B: React / Next.js package
If you're building with React or Next.js, use our typed npm package for a cleaner integration with full TypeScript support.
Identifying logged-in users
When a customer is logged in to your app, pass their identity to Liya so agents can see their name, email, and custom attributes directly in the conversation sidebar. This saves customers from having to repeat themselves.
Call window.Liya.identify() after your authentication flow resolves:
Customising the widget appearance
You can configure the widget appearance to match your brand. All options are set in the window.LiyaSettings object before the script loads:
Appearance options
| Option | Type | Default | Description |
|---|---|---|---|
| accentColor | string | #FF4F00 | Widget button and header colour |
| position | string | bottom-right | Launcher position: bottom-right or bottom-left |
| offsetX | number | 20 | Horizontal distance from the page edge (px) |
| offsetY | number | 20 | Vertical distance from the page edge (px) |
| launcherLabel | string | Chat with us | Text displayed on the collapsed launcher button |
| hideOnMobile | boolean | false | Hide the widget on screens narrower than 768px |
Testing the installation
Load your website
Open the page where you added the snippet. You should see the Liya launcher button in the bottom-right corner.
Send a test message
Click the launcher and type a test message. It should appear in your Liya inbox as a new conversation within a few seconds.
Verify AI draft
Open the conversation in your dashboard. If you have knowledge base content set up, you should see an AI draft ready for review.
Troubleshooting
Widget not appearing
- Check the browser console for JavaScript errors.
- Confirm
workspaceIdis set correctly (no extra spaces or quotes). - If you have a Content Security Policy, add
cdn.liyasupport.comto yourscript-srcallowlist.
Conversations not appearing in inbox
- Ensure your workspace is on an active plan.
- Check Settings → AI Agent → Status is set to "Active".
- Try a hard refresh (
Cmd/Ctrl + Shift + R) in the dashboard.
Content Security Policy
Add the following directives to your CSP header to allow the widget to load and communicate: