Add the Voice Widget to Your Website
The widget lets a visitor talk to your agent from your own website, with no phone number. It either floats in a corner of your page or sits inline, inside an element you choose.
You choose the look and copy the code in Dialora. You paste it into your site once. After that you can change the look, colours and text from Dialora without touching your site again.
1. Choose a look and copy the code
- Open your agent in Dialora and go to the Widget tab.
- Pick a Look (or set the fields yourself) and check the live preview. The preview is simulated: it never places a call.
- Click Save.
- Under Widget embed code, click the copy button.
The script address and the widget ID in the snippet belong to your account. If you use your own domain with Dialora, the address is your domain. Always copy the snippet from the Widget tab.
2. Floating widget: add one line
A floating widget needs only the script line:
<script async src="https://app.example.com/widget.js" data-client-key="wdgt_..."></script>Paste it into every page where the widget should appear, anywhere in the page (before the closing </body> tag is a good place). It loads in the background and does not block your page.
3. Inline widget: add a container too
When the placement is Inline in my page, the Widget tab shows two lines. The first is the container, the second is the script:
<div data-dialora-widget="wdgt_..."></div>
<script async src="https://app.example.com/widget.js" data-client-key="wdgt_..."></script>- Put the container line exactly where the widget should appear. The widget fills the width of the element it is in, so place it in a column or section of the width you want.
- The script line can go anywhere on the same page.
- If the container is added to the page after the script loads (some site builders and apps do this), the widget finds it and moves in. It waits about 10 seconds. If no container appears, the widget floats in the bottom-right corner instead of staying invisible, and writes a note to the browser console (see Widget Not Showing).
- On a site that changes pages without reloading (a single-page app), the widget follows the container when it is removed and added again.
- A page can show several different widgets (see below), but one widget ID only once. If two containers carry the same widget ID, the first one gets the widget and the second stays empty.
- Two floating widgets in the same corner sit on top of each other. Give them different corners in the Widget tab, or make one of them inline.
- A container inside an element that has a CSS
transformcan make a floating widget position itself relative to that element instead of the browser window. Put the script and a floating widget outside such elements.
Showing more than one widget on a page
You can put two or more agents on the same page, for example a sales agent and a support agent.
- Copy the code for each widget from its own agent’s Widget tab. Each widget has its own widget ID.
- Keep one script line on the page. For every other widget, add only its container line,
<div data-dialora-widget="THE_OTHER_ID"></div>, where that widget should appear. It does not need its own script line, although adding one with its own widget ID also works. - A floating widget with no container floats in its corner as usual. A widget with a container lives in that container.
Only one call can be live at a time. If a visitor starts a call in one widget while another is on a call, the first call ends and the new one starts.
Widgets added to a single-page app after the page has loaded (for example when you open another page of the app) are picked up automatically.
4. Add it on your platform
The snippet is plain HTML, so any platform that lets you add a custom code block or a site-wide script can use it. The steps below describe where the code goes in general terms. Menu names change between versions of each platform.
We have not tested the widget on each platform listed here. If a step does not match what you see, use the platform’s own help for “add custom code” or “embed HTML”, and tell us what you found.
| Platform | Where the code goes |
|---|---|
| Plain HTML | Paste it into the page file, before </body>. |
| React, Next.js and other single-page apps | Add the script once in your app shell or root layout. For an inline widget, render the container element in the component where the widget should appear. The widget follows it when you change routes. |
| WordPress | Use a custom HTML block for the inline container. Add the script site-wide with a header and footer code plugin or your theme’s code settings. |
| Shopify | Add the script to your theme’s layout file, or use a custom code or custom liquid section for the inline container. |
| Wix | Use the custom code or embed HTML feature. Some plans restrict custom code. |
| Webflow and Squarespace | Use the site’s custom code area for the script and an embed block for the inline container. Custom code may need a paid plan. |
| Google Tag Manager | Create a Custom HTML tag that contains the script, triggered on the pages where the widget should appear. The widget then finds its widget ID from the script tag. |
5. Check that it works
- Reload your page and look for the widget. A floating widget appears in the corner you chose. An inline widget appears where you placed the container.
- Back in the Widget tab, find the line under the embed code. It says Seen on your site’s address and how long ago, or Not seen yet.
The “Seen on” line is a convenience, not a guarantee. It shows the last website that loaded your widget and updates at most once an hour. It is based on information the visitor’s browser sends, so do not rely on it for security.
A site running an older copy of the widget script keeps showing the classic look (a round button that opens a card) until that copy updates. Reload the page without the cache first. If it persists, contact support.
What the widget adds to your page
The widget draws itself inside a closed container, so your site’s styles cannot change it and it cannot change yours. To work, it adds three things outside that container:
- A
divwith the IDdialora-widget-containerat the end of the page body. - Google’s reCAPTCHA script, unless your page already loads it. The badge is hidden, so the widget shows Google’s required notice itself.
- A small
styleelement in the page head that hides the reCAPTCHA badge.
If your site restricts what it can load
Most sites need nothing extra. If your site sends a Content Security Policy (CSP), or your hosting adds one, it must allow what the widget uses:
| Needed | For |
|---|---|
| Scripts and styles from the address in your snippet | The widget code and its stylesheet |
| Network requests to the Dialora API address | Loading your widget settings and starting a call |
Google reCAPTCHA (www.google.com/recaptcha, www.gstatic.com) | The invisible check before a call |
Twilio’s voice servers (wss://voice-js.roaming.twilio.com, https://eventgw.twilio.com, and https://sdk.twilio.com for default sounds) | The call itself |
| Images from the address of your avatar | The avatar |
Inline style elements, or a nonce | Hiding the reCAPTCHA badge. If blocked, the badge shows. |
The Twilio and Google host names above come from their public documentation and the widget’s code, and we have not checked them against every page configuration. Your browser’s console reports the exact blocked address if a rule is missing.
The page also needs permission to use the microphone. If your site is itself shown inside an iframe on another site, that iframe needs allow="microphone".