Guides
How to Add Live Chat to Your Website: A Step-by-Step Guide for 2026
One script tag, the exact place to paste it on every major platform, and the settings to get right before your first visitor says hello.
ReplyOnSite TeamPublished 11 min read
On this page
Live chat is the shortest path between a visitor's question and your answer. Someone is looking at a product page, wondering whether it ships to their country or fits their use case, and instead of hunting for a contact form they type the question where they already are. If the answer arrives quickly, they keep going.
The good news is that the technical part is small. Every live chat product installs the same way underneath: a short piece of JavaScript on your pages loads the chat widget. The harder part, and the part this guide spends the most time on, is everything around that snippet: where it goes on your platform, what to configure before launch, and how to keep the chat helpful when your team is asleep.
We build ReplyOnSite, so the examples use our snippet and settings. The steps apply to any modern chat tool, and we point out where products differ.
Before you start: what you need#
You need less than you might think. Have these ready and the whole job takes one sitting:
- Admin access to your site. On WordPress that means an administrator account. On Shopify, a staff account that can edit themes. On Wix, Squarespace or Webflow, access to site settings.
- Ten minutes of thinking about hours and ownership. Who answers chats, during which hours, and what should happen outside them? Write it down; you will turn it into settings in Step 3.
- Your top ten customer questions. Shipping times, refunds, pricing, setup steps. They become your saved replies and the first articles an AI assistant can answer from.
- Your brand color and a friendly greeting. A widget that matches your site feels like part of it rather than a third-party popup.
Step 1: Pick a live chat tool#
There are dozens of chat tools and most of them do the basics well. What separates them for a small team is usually cost per seat, how AI is priced, and whether messages from other channels land in the same place. Use this checklist rather than a feature grid:
- A real free plan or a low entry price. You should be able to install and test on your live site before paying. Check whether the free plan expires, caps conversations, or forces branding.
- AI that answers from your content, not the open internet. An assistant that invents a refund policy is worse than no assistant. Look for answers grounded in articles you write or documents you upload, and an obvious way to reach a person.
- Offline behavior you control. An offline form, an AI fallback, or both.
- Your visitors' languages. If you sell internationally, the widget's interface and the AI's replies should follow the visitor's language.
- Room to grow into channels. Many customers would rather message you on WhatsApp, Instagram or Messenger. A shared inbox beats checking four apps. Our guide to adding WhatsApp chat to your website covers this in depth.
- Privacy and security basics. Data export and deletion for privacy requests, two-factor sign-in for your team, and a way to lock the widget to your own domains.
If you are coming from a free tool and comparing options, we wrote an honest breakdown of tawk.to alternatives with prices taken from each vendor's public pricing page.
Step 2: Install the snippet#
After you sign up, your chat tool gives you an install snippet. In ReplyOnSite it is on the Install page of your workspace, with your license key already filled in. It looks like this:
Step 1: Copy your snippet
From the Install page in your workspace. The license key is already in it.
Step 2: Paste it before </body>
On every page, usually through one shared layout or a site-wide setting.
Step 3: Save and publish
Clear any page cache your host or plugin keeps.
Step 4: Open your site
The chat button appears in the corner. Send yourself a test message.
<!-- ReplyOnSite live chat --><script> window.replyOnSiteSettings = { license: "YOUR_LICENSE_KEY" };</script><script src="https://replyonsite.com/widget.js" async></script></body>Three details about that snippet matter more than they look:
- It goes just before the closing body tag. That way your content renders first and the chat loads after it. The
asyncattribute means the browser does not wait for the script before showing your page. - It goes on every page. Visitors ask questions on product pages, pricing pages and checkout pages, not only on the home page. Use a shared layout or a site-wide setting instead of pasting into individual pages.
- It runs in its own frame. ReplyOnSite loads the chat in a sandboxed iframe, so your site's CSS cannot break the widget and the widget's styles cannot leak into your site.
Platform-by-platform steps#
Plain HTML sites
Open each page template (or the shared footer include, if your site has one) and paste the snippet on the line above </body>. Upload the files and reload the site. If you use a static site generator, put it in the base layout so every generated page gets it.
WordPress
You can paste the snippet into your theme's footer, but theme updates can overwrite it. A plugin is safer. ReplyOnSite has a WordPress plugin: upload it under Plugins → Add New → Upload Plugin, activate it, open its settings page and paste the license key from your workspace. The plugin prints the snippet on every page for you.
Shopify
In your Shopify admin go to Online Store, open the menu next to your current theme and choose Edit code (Shopify documents this in Editing theme code (opens in a new tab)). Open Layout → theme.liquid, paste the snippet just before </body> and save. Every storefront page inherits from theme.liquid, so one paste covers the whole store.
Shopify stores get one extra benefit from ReplyOnSite: an AI action that looks up an order's status. It only reveals an order to someone who gives the order number and the email on that order, so "where is my order?" gets answered at 2 a.m. without exposing anyone's purchases.
Wix
Open Settings in your site dashboard and choose Custom Code. Click Add Custom Code, paste the snippet, choose All pages and the Body - end placement, then apply. Wix notes in its custom code guide (opens in a new tab) that your site must be published with a connected domain.
Squarespace
Use Code Injection and paste the snippet into the Footer field, which places code just before the closing body tag on every page. According to Squarespace (opens in a new tab), code injection is available on the Core, Plus and Advanced plans, and checkout pages do not run custom code.
Webflow
Open Site settings → Custom code and paste the snippet into Footer code, then publish the site. Custom code only runs on the published site, not inside the Designer, so test on your live or staging domain.
Google Tag Manager
Create a new tag of type Custom HTML (Google's custom tags documentation (opens in a new tab) covers it), paste the snippet, set the trigger to All Pages and publish the container. This is handy when your marketing team manages scripts without developer releases.
React and Next.js
Load the script once, in the root layout, rather than inside a component that re-mounts on navigation. In Next.js the built-in Script component does this cleanly:
app/layout.tsx
// app/layout.tsx
import Script from 'next/script'
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
{children}
<Script id="replyonsite-settings" strategy="afterInteractive">
{`window.replyOnSiteSettings = { license: "YOUR_LICENSE_KEY" };`}
</Script>
<Script src="https://replyonsite.com/widget.js" strategy="afterInteractive" />
</body>
</html>
)
}Because single-page apps do not reload between routes, the widget stays open while the visitor navigates. If you want the conversation to show which page the visitor is on, ReplyOnSite's JavaScript API includes a setPage call, and identify attaches a signed-in customer's name and email.
Step 3: Configure before you go live#
A widget that appears with default settings looks generic, and a widget that says "We're online!" when nobody is watching is worse than none. Spend fifteen minutes here before you announce anything.
Make it look like your site
Set your brand color, the greeting, the chat title and the launcher button. ReplyOnSite's widget designer shows a live preview as you change things, and each website in your workspace can have its own launcher style, from a classic round button to a labeled pill that shows who is online.
Decide what to ask before the chat starts
A pre-chat form can ask for a name and email before the first message. It helps you follow up, but every field costs some conversations. For most small businesses, asking for an email only when nobody is online is the right balance.
Set your offline behavior
Choose what visitors see outside your hours: an offline form that collects an email, an AI assistant that keeps answering, or both. In ReplyOnSite an offline message becomes a ticket in your workspace, and the visitor can get an automatic acknowledgement, so nothing gets lost in someone's personal mailbox.
Lock the widget to your domains
Your license key is visible in your page source, which is normal for any chat widget. A domain allowlist stops anyone from copying it onto another site. Add every domain you serve, including www and any staging host you test on.
Choose the language
ReplyOnSite's widget interface is available in 15 languages, including right-to-left Arabic. Leave it on auto-detect to follow each visitor's browser, or fix one language for a single-market site. You can also turn on two-way translation in the inbox, so an agent who writes in English replies to a visitor in Spanish.
Step 4: Add AI answers so nobody waits#
Here is the uncomfortable truth about live chat for small teams: most questions arrive when you are busy or offline. An AI assistant fixes that, but only if it answers from your actual policies and steps aside the moment it is out of its depth. Watch how that looks in practice:
- Visitor: Hi, how long does shipping to Toronto take?
- AI assistant: Orders to Canada arrive in 3 to 5 business days, and shipping is free over $60. (Source: Shipping & delivery)
- Visitor: Great. Could you engrave a name on the leather wallet?
- AI assistant: I don't have engraving details in our help articles, so I'm connecting you with the team now.
- System: Handed to Maya · transcript attached
- Maya (Support): Hi! Yes, we can engrave up to 12 characters. What name would you like?
To set this up in ReplyOnSite:
- Write or import your knowledge base. Add articles for your top ten questions, upload PDFs or Word documents (each section becomes a draft article you review), or let the assistant learn pages from your website and import them as drafts.
- Set the persona and rules. Name, tone, reply length, and the handoff keywords that send a chat straight to a person.
- Decide when the AI replies. Always first, or only when agents are away.
- Review the unanswered questions list weekly. Questions the assistant could not answer are logged by demand, and you can turn one into a draft article in a click.
If you are unsure whether you need a bot at all, read our breakdown of AI chatbot vs live chat. For the mechanics of a good escalation, see chatbot to human handoff best practices. Our AI agent page walks through the product side.
Step 5: Test like a visitor#
Before you tell anyone the chat exists, run through this list on your phone and on a laptop:
- Open the site in a private window, so you see what a first-time visitor sees, not your logged-in view.
- Check the button on a product page, a blog post and the checkout or contact page.
- Send a message and confirm it arrives in the inbox, with sound or push notifications on.
- Reply from the inbox and confirm the visitor sees it, including after a page reload.
- Ask the AI three real customer questions and one it should not know. The last one should hand off.
- Switch your status to offline and check the offline message or form.
- Check the widget on a narrow phone screen: the button should not cover your add-to-cart or menu.
Troubleshooting: the widget does not appear#
When the chat button is missing, the cause is almost always one of these, in this order:
- Caching. Your host, a caching plugin or a CDN is serving an old copy of the page. Purge the cache and reload in a private window.
- Wrong template. The snippet went into a page or section that is not used everywhere. Move it to the shared layout or site-wide setting.
- Domain allowlist. The site's hostname, often the
wwwversion or a staging domain, is missing from the widget's allowed domains. - Content Security Policy. If your site sends a CSP header, it must allow the widget script and its iframe. See MDN's Content Security Policy guide (opens in a new tab); you will typically add the chat domain to
script-srcandframe-src. - Consent tools. Some cookie banners block third-party scripts until the visitor accepts. Check how your consent tool categorizes the chat script.
After launch: what to measure#
A chat widget is not a set-and-forget feature. In the first month, look at a handful of numbers rather than every chart:
- First response time. How long visitors wait for the first human or AI reply.
- Missed chats. Conversations that ended without an answer. These usually point to an hours or notification problem.
- AI resolution and handoff reasons. ReplyOnSite's AI report shows how often the assistant resolved a chat and why it handed off: the visitor asked, it had no answer, or the allowance ran out.
- Top topics. What people actually ask about. Recurring topics belong in your knowledge base, your product pages, or both.
- Satisfaction ratings. A short rating prompt after a chat ends tells you whether the speed is matched by quality.
Once web chat is running smoothly, the natural next step is bringing your other conversations into the same inbox: WhatsApp, Messenger, Instagram and Telegram can all be connected per website. The install guide and the product tour show what is available.
Frequently asked questions
How do I add live chat to my website for free?
Sign up for a live chat tool with a free plan, copy its install snippet and paste it just before the closing </body> tag of your site, or into your platform's site-wide custom code setting. ReplyOnSite's Free plan includes one agent seat, one website and 50 AI trial replies, with no card required.
Do I need to know how to code to add a chat widget?
No. You copy and paste a short script. WordPress users can install a plugin and paste a license key instead, and Shopify, Wix, Squarespace and Webflow all have a settings screen where the snippet goes. You never edit the script itself.
Where exactly do I paste the live chat code?
Paste it just before the closing </body> tag so it loads on every page after your content. On Shopify that is the theme.liquid layout file, on Wix it is Custom code with the Body - end placement, on Squarespace it is the Footer code injection field, and in Google Tag Manager it is a Custom HTML tag on All Pages.
Will a live chat widget slow down my website?
A well-built widget loads asynchronously, so it does not block your page from rendering. ReplyOnSite's loader uses the async attribute and opens the chat inside its own iframe, which keeps its code and styles separate from your site.
How do I add live chat to Shopify without an app?
In your Shopify admin go to Online Store, open the theme menu, choose Edit code, open Layout > theme.liquid and paste the snippet just before </body>, then save. Because every storefront page uses theme.liquid, one paste covers the whole store. Re-add it if you switch themes.
What should happen when nobody is online to answer?
Never leave the chat looking live with nobody behind it. Either let an AI assistant answer from your help content and hand off what it cannot answer, or switch the widget to an offline form that collects an email address so your team can reply later.
Why is my chat widget not showing up?
The usual causes are a cached page, a snippet pasted into a template that is not used on every page, a domain allowlist that does not include the site, a Content Security Policy that blocks the script or iframe, or a cookie consent tool that holds scripts until consent. Check each in that order.
ReplyOnSite
Answer every visitor. Hand the hard ones to a person.
Live chat, an AI assistant grounded in your own content, and WhatsApp, Messenger, Instagram and Telegram in one inbox. The Free plan needs no card.
Keep reading
AI support
AI Chatbot vs Live Chat: Which Does Your Small Business Need?
Bots are fast and tireless, people are trusted and flexible. A practical framework for deciding which questions go to which, and how to combine them.
10 min read
Channels
WhatsApp Chat for Your Website: Links, Buttons and a Shared Inbox Compared
A wa.me link takes five minutes. A shared team inbox takes an afternoon. Here is what each level really gives you, and when the extra setup is worth it.
10 min read
AI support
Chatbot to Human Handoff: How to Build AI Customer Support That Knows When to Step Aside
The triggers, rules and context that turn an AI assistant from a wall between you and your customers into a fast first line with a person right behind it.
11 min read