The Post Office

How to add live chat to your website (free, in 5 minutes)

Add live chat to your website with one code snippet: where to paste it on HTML, WordPress, Shopify, Squarespace, Wix, Webflow, Framer, React, or Google Tag Manager, and what to set up before you go live.

To add live chat to your website, you sign up for a live chat tool, copy the code snippet it gives you, and paste it into your site before the closing </body> tag. On WordPress, Shopify, Squarespace, Wix, Webflow, or Framer you paste it into a custom code setting. You can also add it once through Google Tag Manager. The chat widget then appears on every page.

That part takes five minutes. The setup around it takes longer: who answers, what happens at night, and where the chats land.

I use Fernand's support widget in the examples because I know its code. Other tools work the same way. Only the snippet changes.

1. Pick a live chat tool

Three questions narrow the list:

  • Who answers? You alone, a small team, or an AI agent first and a person after.
  • Where do chats go? Into the same inbox as your support email, or a separate app you have to check.
  • What does it cost at your size? Read the price per seat, and the price per AI answer if there is one. A cheap plan can grow fast.

For a small SaaS team I would want chat and email in one inbox, help articles inside the widget, and an AI agent that admits when it is stuck. Fernand's support widget does those, and the free plan includes the AI agent in chat. If you are comparing tools, I wrote up Crisp, Tidio, and Intercom.

2. Copy your code snippet

Every live chat tool gives you a snippet after sign-up. Fernand's looks like this:

<script>
(function (w){if (typeof w.Fernand !== "function") {var f = function () {f.q[arguments[0] == 'set' ? 'unshift' : 'push'](arguments);};f.q = [];w.Fernand = f;}})(window);
Fernand('init', { appId: 'your-organization-name' })
</script>
<script async src="https://messenger.getfernand.com/client.js"></script>

Replace your-organization-name with your workspace name. It is in your Fernand address: if you log in at app.getfernand.com/piedpiper/, your appId is piedpiper.

3. Paste it into your website

Paste the snippet once, in a place that loads on every page. Put it at the end of the page, just before </body>, so it never slows down your content.

Plain HTML

Open your page template, or each HTML file, and paste the snippet just before </body>. Upload the files again.

WordPress

You do not need a chat plugin. Install the free WPCode plugin ("Insert Headers and Footers"), open Code Snippets → Header & Footer, and paste the snippet into the Footer box. Save, then clear your cache if you use a caching plugin.

Google Tag Manager

If Tag Manager already runs on your site, go to Tags → New → Tag Configuration → Custom HTML. Paste the snippet, set the trigger to All Pages, save, and publish the container.

Shopify

In your admin, open Online Store → Themes, then … → Edit code on your live theme. Open layout/theme.liquid, paste the snippet just above </body>, and save.

Squarespace

Open Settings → Advanced → Code Injection and paste the snippet in the Footer box. Squarespace only offers Code Injection on some plans, so check yours first.

Wix

Go to Settings → Custom Code → Add Custom Code. Paste the snippet, choose All pages, place it in Body – end, and apply. Wix asks for a premium plan with a connected domain before it runs custom code.

Webflow

Open Site settings → Custom code and paste the snippet into Footer code. Save and publish. Webflow runs custom code on paid site plans.

Framer

Open Site Settings → General → Custom Code, paste the snippet into End of <body> tag, and publish.

React or Next.js

Load the widget once, in a component at the root of your app:

import { useEffect } from 'react'

export function SupportWidget({ appId }) {
  useEffect(() => {
    if (document.getElementById('fernand-client')) return
    if (typeof window.Fernand !== 'function') {
      const f = function () { f.q[arguments[0] === 'set' ? 'unshift' : 'push'](arguments) }
      f.q = []
      window.Fernand = f
    }
    window.Fernand('init', { appId })
    const script = document.createElement('script')
    script.id = 'fernand-client'
    script.async = true
    script.src = 'https://messenger.getfernand.com/client.js'
    document.body.appendChild(script)
  }, [])
  return null
}

The ID check keeps React's development mode from loading the widget twice. If you would rather build the chat UI yourself, the inbox can sit behind your own components. I covered that in headless customer support.

4. Set it up before you switch it on

A chat box nobody answers is worse than no chat box. Decide these four things before launch.

Who answers, and when. Set your chat hours. With Fernand, chatAvailability: 'business-hours' shows visitors when you will be back, and responseTime tells them how long a reply takes. They leave an email address, so your answer still reaches them.

What the AI may answer. An AI agent trained on your help articles handles the repeated questions at 2am. Name it as an AI in the widget (aiAgentName), keep a visible way to reach a person, and write down what it must hand over, such as refunds. I wrote about that moment in chatbot to human handoff.

Who is writing. If your visitors are logged-in customers, pass their name and email to the widget with a verification hash. They stop typing their email into every chat, and you see their account next to the message.

Where chats land. Chats should arrive in the same queue as your support email. In Fernand they land in the shared inbox. A customer can start in chat and you can finish by email on the same thread. That is what conversational customer service means for a small team.

Then match the widget to your site: accent color, light or dark theme, left or right, and which tabs show (chat, help articles, contact form).

5. Check privacy before launch

A chat widget stores some data in the visitor's browser and sends messages to your provider's servers. If you show a cookie banner, ask your provider what the widget stores and list it in your privacy policy. Do this whichever tool you pick. Fernand's servers are in France, and I keep the details on the GDPR page.

6. Test it

Open your site in a private window and on your phone. Send a message. Check that it reaches your inbox, reply, and confirm the reply shows up in the chat. Then try it outside your chat hours and make sure the "we'll be back" message makes sense.

If the widget does not appear, the snippet is usually missing from that page, a cache is serving the old version, or the appId has a typo.

Questions

How do you add live chat to a website?

Sign up for a live chat tool, copy the code snippet it gives you, and paste it before the closing body tag of every page. On WordPress, Shopify, Squarespace, Wix, Webflow, or Framer you paste it in the site's custom code setting instead of editing files. Then decide who answers and test a conversation.

Can I add live chat to my website for free?

Yes. Several tools have a free plan. Fernand's free plan includes the support widget with live chat, your knowledge base, and the AI agent in chat.

Do I need to know how to code?

No. You copy one snippet and paste it into one box. The only place you touch code is a plain HTML site or a React app, and even there it is a copy and paste.

Can I add ChatGPT or an AI chatbot to my website?

You can, but a general chatbot does not know your product. An AI agent trained on your help articles and past replies answers from them, says when it is an AI, and hands the chat to a person when it cannot answer.

What happens when someone writes and nobody is online?

Set chat hours. Outside them, the widget tells the visitor when you will be back and asks for an email address, so the reply reaches them later. An AI agent can answer the common questions in the meantime.

Continue reading