Connecting the Website Widget No dashboard needed
The website widget is the odd one out among audiencechat's channels: there's no third-party developer account, no app review, and no dashboard to configure anywhere else — everything happens inside audiencechat's own admin panel, and the only thing you paste elsewhere is a single line of HTML on your own site.
In plain words
What this is. A chat bubble in the corner of your own website. Visitors click it and chat with your AI, without leaving your site and without installing anything.
The problem it solves. Many visitors have a quick question and leave if they cannot ask it. Not everyone wants to open WhatsApp or give a phone number. The widget lets them ask right there.
How it works. You paste one line of code into your website. That line loads the chat bubble. Messages go to the same Inbox as all your other channels.
How long it takes. About 5 minutes, if you can edit your website.
For what a channel is and how to manage one afterwards, see Channels.
1. Create the channel in audiencechat
- In audiencechat, go to Channels → Add channel.
- Choose Website widget, give it a name (e.g. "Website Chat").
- Optionally choose an assistant now, or do it later from the channel's card — no credentials are required, so this is the shortest of every channel's setup.
- Save.
2. Copy the embed snippet
On the new channel's page, audiencechat shows an embed snippet that looks like this:
<script src="https://yourdomain.com/widget.js" data-channel="wc_8f3kQ2..." async></script>
Paste it just before the closing </body> tag on every page of your site where you want the chat bubble to appear — a shared footer/layout template is the usual place if your site has one, so you only add it once.
data-channelis this channel's own key — copy it exactly as shown, don't reuse another channel's snippet.- The script is loaded with
asyncand adds nothing to your page until it finishes loading, so it won't block your site's own rendering. - Widget language. The bubble's buttons show in each visitor's browser language. To fix one language instead, choose it under Widget language above the snippet; the snippet then gets a
data-langattribute (for exampledata-lang="es"). The AI always answers in the language the visitor writes in.
3. Test it
Open your site in a normal (or incognito) browser tab. A round chat launcher button appears in the bottom-right corner. Click it, send a message, and it should appear in audiencechat's Inbox within a few seconds and, if a knowledge base is linked, get an AI reply within about 5 seconds — the widget checks for new replies on a short poll, not instantly.
If nothing arrives within a minute, see Troubleshooting & FAQ.
Protect your chat from spam
The snippet is visible in your page's source, so anyone can copy it. To stop a copy from being misused, open the channel's page and use Protect your chat:
- Allowed websites. Enter your website's domain, one per line (for example
shop.com). The chat then only works on those websites and their subdomains (help.shop.comtoo). Enteringwww.shop.comcounts asshop.com, so the site works with and withoutwww. A copy of your snippet on someone else's site shows the bubble, but every message is refused. Leave the list empty to allow any website; the page warns you while it is empty. Addlocalhostif you also test on your own computer. - Make a new key. If someone is misusing your snippet anyway, make a new key. The old snippet stops working at once, everywhere, so paste the new one on your website straight away. Visitors start a new chat after the change.
- Identity secret (optional). Only needed if your website has its own server. That server uses this secret to sign the email it passes to
identify(), so nobody else can claim to be one of your customers. See Recognising a visitor across devices. If it leaks, choose Make a new secret and put the new one on your server; signatures made with the old one stop matching at once.
These work on their own, with nothing to set up:
- Limits for new visitors. One network (IP address) can start only a few new chats per hour, and each chat takes only so many new visitors per hour. A visitor already chatting is never cut off. When a limit is reached, the bubble tells new visitors to try again later.
- A quick check for new visitors. Your platform may ask a new visitor to pass a short check, usually invisible, before their first message. It keeps scripted spam out. A visitor already chatting is never asked again.
- Blocking. In the Inbox, open the conversation's menu and choose Block contact, or use the same button on the person's contact page. Their new messages are ignored and the conversation is closed. On the website chat, new chats from the same network are refused too, which can include other people in the same office or on the same mobile network. Choose Unblock contact in the same place to undo it. Blocking works on every channel, and needs the permission to manage contacts.
Buttons in the chat
When an automation sends quick replies, a list or a link button, the chat shows them as buttons under the message. A visitor taps one and the chosen words are sent as their reply. A link button opens the page in a new tab.
How visitor sessions work
A visitor never logs in or signs up. The widget generates a random session ID the first time it loads and stores it in the browser's localStorage, then reuses that same ID on every later visit from the same browser — so a returning visitor sees their previous conversation continue, but a different browser or device always starts a brand-new one. Clearing site data or browsing in a private window also starts a new conversation, since there's nowhere for the session ID to persist.
Recognising a visitor across devices
Once audiencechat knows a visitor's email address, it saves it on their contact, so your team sees who they are. That works on any website, even a plain HTML one. Optionally, if your website has its own server, it can also sign that email, and audiencechat then joins up the visitor's conversations from different browsers and devices.
-
From a lead form. When a visitor answers an Email field in a lead form with a valid address, the email is saved on their contact. A typed answer is not proof of who someone is, so it never brings back conversations from another device.
-
From your own site. If your visitors log in to your website, you already know their email. After the embed snippet, call:
window.ChatWidget && window.ChatWidget.identify('visitor@example.com', { name: 'Jane Doe' });with the signed-in user's real email (your site's template fills it in). The channel page shows the exact line to copy under Optional: identify a known visitor; the name after
window.may differ fromChatWidget, andChatWidgetworks either way. Because the widget loadsasync, run it after the page has loaded (e.g. onwindow'sloadevent); if the widget isn't ready yet, the call simply does nothing.
Signing the email
This step is optional and needs a server of your own: without it, identify() still saves the email and details on the visitor. user_hash proves the email came from your website and not from someone typing it into their browser. Your server makes it with the Identity secret from the channel's page (under Protect your chat): it is the HMAC-SHA256 of the exact email you pass, written as hex.
// PHP
$userHash = hash_hmac('sha256', $user->email, 'YOUR_IDENTITY_SECRET');
// Node.js
const userHash = require('crypto')
.createHmac('sha256', 'YOUR_IDENTITY_SECRET')
.update(user.email)
.digest('hex');
# Python
user_hash = hmac.new(b'YOUR_IDENTITY_SECRET', user.email.encode(), hashlib.sha256).hexdigest()
Put the result in your page next to the email, as user_hash with the details: identify(email, { name: 'Jane Doe', user_hash: 'SIGNED_ON_YOUR_SERVER' }). You can also pass it as a third argument: identify(email, details, userHash).
- Signed: if your site signed the same email in an earlier session on this channel, audiencechat moves those earlier conversations, lead form answers, and broadcast history onto the current session. The chat window shows their full history, and your Inbox shows one customer instead of two. Matching is per channel: the same email on two different widget channels stays two separate customers.
- Not signed: the email (and any details) are saved on this visitor only. Their earlier conversations stay where they are and are never shown in this browser, and a later signed call never pulls this visitor's chat into someone else's history.
- Signed wrongly: the call is refused and nothing is saved. The browser console says so. Check that you sign exactly the email you pass, with the current secret.
Sign on your server only. The identity secret must never appear in your page, your JavaScript or your app: anyone who has it can sign any email and read that customer's chat history.
Passing more details
You can also pass what else you know about the visitor, so the contact arrives filled in:
window.ChatWidget &&
window.ChatWidget.identify('visitor@example.com', {
name: 'Jane Doe',
phone: '+1 555 010 0200',
country: 'US',
language: 'en',
plan: 'Pro',
});
nameandphonereplace what the contact has.country(two letters) andlanguageare only filled in when the contact has none yet, since the widget already detects them.- Any other key fills the custom contact field with that key, such as
planabove. Keys you haven't defined as a custom field are ignored. - A value that doesn't fit (a phone number that's too short, an option a select field doesn't have) is skipped; the rest are still saved.
Pass only what your own site knows about its signed-in user, never something a visitor typed into a form.
Every widget conversation appears in the same admin Inbox as WhatsApp, Telegram, Instagram, and Messenger conversations — there's nothing separate to check.
Widget not appearing at all? A strict Content-Security-Policy (CSP) header on your site can silently block the widget's <script> tag or its requests back to audiencechat. See Troubleshooting for what to add to your CSP.