Embed the widget on your website
The quickest way to get the Univerx widget running on your website is to paste a single <script> tag into your HTML. No build tools, no package manager — it works on any website or CMS.
If you are building a JavaScript app and need a custom UI or fine-grained control, see the Client SDK instead.
Before you start
Section titled “Before you start”- You must have an Admin or Owner role in your Univerx organization.
- You need an active widget configured in your dashboard with at least one queue assigned. See Set up your website widget.
- Copy the widget key from Admin console → Widgets → your widget → Embed code.
Add the widget to your site
Section titled “Add the widget to your site”-
Add the script tag
Paste the following snippet just before the closing
</body>tag on every page where you want the widget to appear.<scriptsrc="https://cdn.univerx.ai/widget@latest/index.js"defer></script> -
Initialize the widget
Directly after the script tag, add an initialization snippet with your widget key:
<script>window.addEventListener('univerx:ready', function () {window.UniversxWidget.init({widgetKey: 'YOUR_WIDGET_KEY',});});</script>Replace
YOUR_WIDGET_KEYwith the key you copied from the dashboard. -
Verify it works
Open the page in your browser. A support button should appear in the bottom-right corner. Click it to confirm the widget loads and connects to your queue.
If you see a
401 Unauthorizederror in the browser console, double-check:- The widget key is correct.
- The domain you are testing on is listed under Widgets → your widget → Domains.
Full example
Section titled “Full example”Here is a minimal HTML page with the widget embedded:
<!DOCTYPE html><html lang="en"> <head> <meta charset="UTF-8" /> <title>My website</title> </head> <body> <h1>Welcome</h1>
<!-- Univerx widget --> <script src="https://cdn.univerx.ai/widget@1.0.0/index.js" defer ></script> <script> window.addEventListener('univerx:ready', function () { window.UniversxWidget.init({ widgetKey: 'YOUR_WIDGET_KEY', }); }); </script> </body></html>Configuration options
Section titled “Configuration options”Pass additional options to init() to customize the widget’s appearance and behavior.
<script> window.addEventListener('univerx:ready', function () { window.UniversxWidget.init({ widgetKey: 'YOUR_WIDGET_KEY',
// Position the button ('bottom-right' | 'bottom-left') position: 'bottom-right',
// Override the display language ('en' | 'de') locale: 'en',
// Custom theme colors theme: { primaryColor: '#0055FF', fontFamily: 'Inter, sans-serif', }, }); });</script>| Option | Type | Default | Description |
|---|---|---|---|
widgetKey | string | — | Required. Your widget key from the dashboard |
position | 'bottom-right' | 'bottom-left' | 'bottom-right' | Corner where the button appears |
locale | string | Browser locale | Override the display language |
theme.primaryColor | string | Dashboard setting | Button and accent color (hex or CSS variable) |
theme.fontFamily | string | Inherited | Font used inside the widget |
Embed in popular platforms
Section titled “Embed in popular platforms”- In the WordPress admin, go to Appearance → Theme file editor (or use a plugin like Insert Headers and Footers).
- Paste both script tags before the closing
</body>tag in your theme’sfooter.php. - Save and preview your site.
- Open your project settings in Webflow.
- Go to Custom code → Footer code.
- Paste both script tags and click Save changes.
- Publish your site.
- In the Shopify admin, go to Online store → Themes → Actions → Edit code.
- Open
layout/theme.liquid. - Paste both script tags before the closing
</body>tag. - Save the file.
- In the Squarespace admin, go to Settings → Advanced → Code injection.
- Paste both script tags into the Footer field.
- Save.
Troubleshooting
Section titled “Troubleshooting”Widget button does not appear
Section titled “Widget button does not appear”- Confirm the script tag is on the page by inspecting the page source.
- Make sure you are listening for
univerx:readybefore callinginit()— calling it too early (before the script has loaded) will throw a reference error. - Check the browser console for errors.
401 Unauthorized
Section titled “401 Unauthorized”Your widget key is invalid or your domain is not allowlisted. Go to Admin console → Widgets → your widget and add your site’s origin (including protocol, e.g. https://example.com) to the Domains list.
Widget appears but the queue is empty
Section titled “Widget appears but the queue is empty”No agents are online or the widget is not assigned to a queue. Check Admin console → Queues and ensure at least one agent has an active session.
Content Security Policy (CSP) errors
Section titled “Content Security Policy (CSP) errors”Add the Univerx CDN and API origins to your CSP header:
Content-Security-Policy: script-src 'self' https://cdn.univerx.ai; connect-src 'self' https://api.univerx.ai; frame-src 'self' https://meet.univerx.ai;