Add Chat to Website HTML: Build Your Snippet, Choose Bubble or Inline, and Paste It in the Right Place
Add chat to website HTML pages and you skip plugins entirely: one script tag, pasted in the right spot, and the chat appears. This guide is for sites built from plain HTML files, templates or a static site generator. It explains where the tag belongs in the document and why, how to put it on fifty pages without pasting fifty times, how to place the chat inside a page instead of as a floating bubble, and gives you a builder that writes the snippet and inserts it into your page for you.
⚡ In short
- Paste the script just before the closing body tag, once per page.
- On a multi-page site, put it in a shared footer, include or layout file so every page gets it automatically.
- For inline chat, add an empty div where the chat should sit and point data-target at its id.
- Use the bubble script on most pages and the inline version only on the page with the box.

Where it goes
The right spot in an HTML document, and why
An HTML page has two main parts: the head, which holds information about the page, and the body, which holds what visitors see. The chat script can technically go in either, but the best place is at the very end of the body, just before the closing body tag.
Why the end of the body
Browsers read a page from top to bottom. A script near the bottom loads after your text, images and menus have started to appear, so visitors see your content first and the chat bubble a moment later. The async attribute on the tag also tells the browser not to wait for the chat, so your page never stalls because of it.
Why not inside a paragraph or section
The script doesn’t draw anything where it sits; it adds the chat to the page as a whole. Placing it inside a content block makes no visual difference, but it makes the tag easy to delete by accident when someone edits that section later.
One copy per page
If the tag appears twice on a page, only the first copy runs. A duplicate isn’t harmful, but two copies with different keys can show the wrong website’s chat. Keep exactly one.
The key ties it to your website
The data-key value tells the widget which website, settings and inbox to use. Each website in your account has its own key. Copy it from your dashboard rather than typing it.
Free tool
Build your snippet and insert it into a page
Choose bubble or inline, add your key, and optionally paste a page. The builder writes the snippet and puts it in the right place.
Bubble or inline
Choosing between a floating bubble and a chat inside the page
The floating bubble
The default. A round button sits in a bottom corner of every page and opens the chat when tapped. It's always available, whatever page the visitor is reading. Use it on almost every site.
Inline chat
The chat appears inside your page, in a box you place, like a form or a map. Nothing floats. It suits pages whose whole purpose is conversation: a contact page, a booking page, a "talk to an advisor" page, or a help centre. Visitors see the conversation area immediately without having to find a button.
Combining them
Use the plain bubble script on most pages and the inline script only on the page with the box. Don't put both versions on the same page: only the first copy runs, so you'd get one or the other, not both.
Sizing an inline box
The box fills the width of the element you place it in, so control the width with your own layout, such as a column or a container. Control the height with data-height, in pixels; 600 is the default. Between 500 and 650 works for most pages. On phones the box keeps the height you set, so test that it doesn't push your address and phone number too far down.
When you add chat to website HTML pages with inline mode, the target element must exist on the page. If data-target points to an id that isn't there, there's nowhere to draw the chat; the browser console shows a "target not found" warning.
Example
An inline contact section you can adapt
A simple two-column layout: details on the left, chat on the right. Replace YOUR_KEY with your own.
<section class="contact">
<div class="contact-details">
<h2>Talk to us</h2>
<p>Mon to Sat, 10 am to 7 pm. Outside these hours, leave your number in the chat and we'll call you back.</p>
<p>Phone: 98xxx xxxxx</p>
</div>
<div id="chat-box"></div>
</section>
<style>
.contact { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 700px) { .contact { grid-template-columns: 1fr; } }
</style>
<!-- just before </body> -->
<script src="https://livechatbot.in/widget.js" data-key="YOUR_KEY"
data-mode="inline" data-target="#chat-box" data-height="560" async></script>
Many pages
Getting the snippet onto every page without pasting it fifty times
A hand-built site with many pages is where most installs go wrong: the chat appears on the homepage and nowhere else, because the tag was pasted into one file. The fix depends on how your site is built.
Plain HTML files, each written separately
Every file needs the tag. Use your editor's "find and replace in files" (in VS Code, the search panel across the folder): find the closing body tag and replace it with the script tag followed by the closing body tag. Check the count it reports matches your number of pages, then upload everything.
PHP includes or server-side includes
If your pages share a footer.php or an included footer file, paste the tag there once, just before the closing body tag if the file contains it, or at the end of the footer otherwise. Every page that includes the footer gets the chat.
Static site generators
Jekyll, Hugo, Eleventy, Astro and similar tools build pages from a base layout. Put the tag in that layout, for example _layouts/default.html in Jekyll or layouts/_default/baseof.html in Hugo, then rebuild. For one inline page, add the div and the inline script to that page's own template and leave the bubble out of it.
Single-page apps
Load the script once in the main HTML file. Because the page doesn't reload between screens, call LiveChatBot.pageView() after each route change so your team sees which screen the visitor is on.
Whatever the method, add chat to website HTML templates in one place whenever you can. It saves the "chat missing on the new page" problem forever.
Upload
Getting the updated files live
Pick the way your site is hosted. Purge any cache afterwards.
1
cPanel or hPanel file manager
Open the file manager, go to public_html, edit the file (or upload the new one), save. Repeat for each changed file.
2
FTP or SFTP
Connect with FileZilla or similar, upload the changed files over the old ones, and keep a copy of the old ones until you've tested.
3
Git-based hosting
Netlify, Vercel, GitHub Pages, Cloudflare Pages: commit and push. The host rebuilds and publishes in a minute or two.
After you add chat to website HTML files, upload them carefully. Some hosts replace whole folders when you upload a zip. Upload complete files or folders, never a partial set, and keep a backup of the site before any change. If the chat doesn't appear after uploading, our script troubleshooting guide checks your page source for the ten usual causes.
Beyond the snippet
Small extras that HTML sites can add
Once the tag is in place, a few lines of HTML can make the chat more useful. These use the JavaScript API, which is available once the widget has loaded.
A "Chat with us" link in your menu
Add a link or button that calls LiveChatBot.open() when clicked. Visitors who never notice the bubble find the chat in the menu.
A button on product or service pages
"Ask about this product" next to the price, opening the chat. More effective than a generic bubble on pages where questions are specific.
Tell the team who's logged in
If your site has accounts, LiveChatBot.setVisitor() can pass a logged-in visitor's name and email so your team doesn't have to ask.
For anything beyond these, ask our team for developer documentation. Everything else, from colour and welcome text to opening hours and which pages show the chat, is set in your dashboard and needs no code change. See how to customise your chat widget and how to show live chat on specific pages.
Test
A short test after uploading
Tick each step. Your ticks stay in this browser tab only.
Getting started
From sign-up to live chat in fifteen minutes
Sign up, add your website, and copy the install code from your dashboard. Use the builder above to make the bubble or inline version and insert it into your template, then upload. Set your colour, welcome text and opening hours in the dashboard; they apply instantly without touching the HTML again. The setup guide walks through the rest of the first day.
LiveChatBot's free plan covers two websites with 100 visitors per website each month, including inline mode, the JavaScript API, the inbox and the Android app. Start on livechatbot.in.
Frequently asked questions
Where do I paste the chat code in HTML?
Just before the closing body tag, once per page, or once in a shared footer or layout file so every page gets it.
Can I put the chat inside a page instead of a floating bubble?
Yes. Add an empty div with an id, and use the inline script with data-mode="inline" and data-target pointing at that id.
How do I add chat to website HTML pages that share no template?
Use your editor's find and replace across files: replace the closing body tag with the script tag followed by the closing body tag, then upload all the files.
Can one page have both a bubble and an inline chat?
No. Only the first copy of the script on a page runs. Use inline on the page with the box and the bubble everywhere else.
Do I need to change the HTML to change the chat colour or text?
No. Look, wording, hours and page rules are set in your dashboard and update on your site automatically.
Keep reading
Related guides
Add Chat to Website Free: What the Free Plan Covers, When You'd Ever Pay, and a Yearly Cost Calculator
Add a Chatbot to Your Website Without Crowding the Screen: A Corner Planner for Bubbles, Buttons and Banners
Abstract of Chatbot Projects: How to Write One Examiners Approve, With a Free Abstract Builder
One line of HTML, and you're live
Build your snippet above, paste it once in your layout, and start chatting. Start free on livechatbot.in.