Skip to main content
SiGMA World Rome · booth H7-7129 →
§ Guide · Website

Putting the chat widget on your site

The widget is a chat bubble in the corner of your own pages. A visitor types, your agent answers, and the conversation lands in the same inbox as Telegram and WhatsApp. Setting it up is one screen in DialogBrain and two script tags on your site.

Updated 2026-11-26
§ Before you start
  • A DialogBrain workspace open in a browser. The widget belongs to the workspace, so conversations it brings in are visible to your colleagues.
  • Somewhere to paste two lines of HTML on your site — a template, a theme footer, or a tag manager. No developer is needed if you can already edit the page, but you do need access to it.
  • An agent you want answering. A widget with no agent assigned still collects conversations; it just leaves them sitting unanswered, which is what the routing line on the widget card is there to tell you.
  1. Step 1

    Open LiveChat from the Tools menu

    The widget lives outside the inbox: open the Tools menu in the header and pick LiveChat, near the bottom of the Automation group.

    The page has two tabs. Widgets is where you create and configure them; Contacts is where the leads the widget captures pile up later.

    Tools → LiveChat. The same menu holds AI Agents and Outreach.
  2. Step 2

    Press Create Widget

    Each widget is one installation: its own key, its own look, its own list of allowed domains. Most businesses need exactly one; make a second when you have a second site, or a landing page that should behave differently from the main one.

    Widgets already created are listed as cards here, each with its routing and a Copy Embed button.

    One card per widget. The toggle on the card switches it off without deleting it.
  3. Step 3

    Name it, choose how it appears, set the colours

    The name is internal — it is how you will recognise this widget in the list, not something a visitor sees.

    Display mode is the one choice worth slowing down for. Chat is the bubble that opens a full panel with text and a mic, and is what almost everyone wants. Voice only is a mic bubble that dials straight into a call with no chat panel. Headless renders nothing at all and hands you a JavaScript API to wire into your own design.

    Appearance is what visitors see: the primary colour, which corner it sits in, and the two lines in the panel header. The header subtitle is a good place for an honest expectation — "we typically reply within minutes" reads better than silence.

    Chat is the default and the right answer unless you specifically want a call button.
  4. Step 4

    Restrict it to your own domains

    Further down the same dialog is the domain whitelist. Leave it empty and the widget works on any site that carries the key; add your domains and it works only there.

    Add it. The widget key is not a secret — it sits in the source of every page you put it on, where anyone can read it — so the domain list is what stops somebody pasting your key into their own site and spending your agent on their visitors.

    Rate limiting below it caps messages per minute per visitor. The default of 20 is generous for a person and tight for a script.

    Empty means any site. One entry per domain, and www counts as a different one.
  5. Step 5

    Copy the embed code and paste it on your site

    Save, and the widget appears as a card. Copy Embed puts two script tags on your clipboard — the first names your widget, the second loads the widget itself.

    <script>
      window.DialogBrainLiveChat = { widgetKey: "your-widget-key" };
    </script>
    <script src="https://dialogbrain.com/livechat/widget.js" async></script>

    Paste them just before the closing </body> tag, on every page where the bubble should appear. A tag manager works too: it is ordinary HTML with no dependencies.

    Reload the page and the bubble is in the corner. Everything else — colour, greeting, which agent answers — is changed in DialogBrain afterwards, and never needs you to touch the site again.

    The routing line is the one to read: it names the agent that will answer.
  6. Step 6

    Let the agent see what the visitor is looking at

    When a visitor writes "explain this" or "is this in stock?", the agent answers about the page they are on. The Page context setting of the widget decides where that knowledge comes from.

    Page text (the default): the widget reads the page itself — its title, description, headings and the text the visitor can see. Nothing to install.

    If your pages are built by JavaScript and show different things at the same address — a dashboard, a report, a configurator — mark the part the visitor is reading, and the widget reads exactly that part:

    <section data-dialogbrain-context>
      … the part of the page the visitor is reading …
    </section>

    Site data: your page hands the agent the facts itself — an order number, a plan, the report on screen — as a small JSON object, and no page text is sent. Both sends the page text and your data together.

    <script>
      window.DialogBrainLiveChat = {
        widgetKey: "your-widget-key",
        // What is on screen, read every time the visitor sends a message
        getContext: () => ({
          page: "order",
          orderId: window.currentOrder?.id,
          status: window.currentOrder?.status,
        }),
      };
    </script>
    <script src="https://dialogbrain.com/livechat/widget.js" async></script>
    
    <script>
      // Or plain data, at any moment, even before the widget has loaded
      window.DialogBrainLiveChat.context = { page: "report", reportId: "R-1042" };
    </script>

    getContext is called on every message, so it always sends what is on screen now. The context property can be assigned at any moment, before or after the widget loads, and is read at the next message. Up to 8 KB of plain data — text, numbers, lists — and the agent receives all of it; a larger object is not sent. The agent is told the data comes from your page and that a visitor could change it in their browser, so keep prices and permissions in your own systems, not only here.

  7. Step 7

    If your site is on WordPress

    The safest place is a header-and-footer plugin such as WPCode or Insert Headers and Footers: install it, open its settings, paste the snippet into the Footer box and save. It then loads on every page and survives theme updates.

    If you would rather not add a plugin, open Appearance → Theme File Editor, pick footer.php and paste the snippet just above </body>. Use a child theme, or the next theme update wipes it.

  8. Step 8

    If your shop is on Shopify

    Open Online Store → Themes, press the three dots next to your current theme and choose Edit code. Under Layout open theme.liquid, paste the snippet just above </body>, and save.

    theme.liquid wraps every page of the shop, so the bubble appears everywhere, including the cart and the checkout's information step. Switching themes later means pasting it again into the new theme.

  9. Step 9

    If your site is on Wix

    Open the site's dashboard, go to Settings → Custom Code (under Advanced) and press Add Custom Code. Paste the snippet, give it a name, choose All pages, set the placement to Body - end, and apply.

    Wix allows custom code only on a Premium plan with a connected domain; on a free site the button is there but the code does not load.

What happens once it is live

Conversations arrive in the shared inbox next to every other channel, in real time. A visitor who comes back sees their previous messages if you left "show visitor history" on.

The agent named on the routing line answers. If that line says no agent, the widget is collecting conversations and nobody is replying — assign an agent to the livechat channel and it starts.

Leads the agent captures land under LiveChat → Contacts, with the name, the phone and what the person wanted, and can be exported as CSV.

§ Q & A
Do I need a developer to install it?

Not if you can already edit your pages. It is two script tags pasted before the closing body tag — the same operation as adding an analytics snippet — and it works through a tag manager as well.

Is the widget key a secret?

No, and it cannot be: it sits in the page source of every site that uses it. That is exactly why the domain whitelist exists — the key identifies the widget, the domain list decides where it is allowed to run.

The bubble is there, but nobody answers. Why?

Almost always because no agent is assigned to the livechat channel. Look at the routing line on the widget card: it either names the agent that will answer, or says there is none.

Can I change the colour or the greeting later?

Yes, and without touching your site. The embed code carries only the widget key; everything else is read from DialogBrain when the page loads, so an edit takes effect on the next reload.

What is the difference between Chat, Voice only and Headless?

Chat opens a panel where visitors type, with a mic available. Voice only skips the panel and starts a call. Headless renders no interface at all and gives you a JavaScript API to drive from your own design — pick it only if you intend to build the chat UI yourself.

Can I put one widget on several sites?

Yes — add every domain to the whitelist and reuse the same snippet. Use separate widgets when the sites should look different or be answered by different agents, since both are per-widget settings.