How to add a custom AI chatbot to your Squarespace website
· 6 min read
Squarespace sites are built to look good with as little fiddling as possible, and adding an AI chat assistant keeps to that. Squarespace has a setting for site-wide code, Code Injection, and that's where the chat's one line of code goes, once, for every page.
This guide uses Pixexl's assistant as the example, but the steps are the same for most chat tools that give you a script tag.
Before you start
You'll need four things:
- A plan with Code Injection. Squarespace includes it on its paid plans above the entry tier. If you can't find the setting below, check your plan under Settings → Billing.
- Admin access to the site, as its owner or an administrator.
- Your chat's embed code. In Pixexl, it's on your project's Settings tab, under the integration code. It looks something like this:
<script
src="https://…/pixe-widget.js"
data-project-id="your-project-id"
data-api="https://…"
async
></script>
- Your domain added to the project. For security, the chat only runs on domains you've allowed. If you also view the site on its
squarespace.comaddress, add that too.
It's also worth giving the assistant something to answer from first: add your site's pages as its knowledge (see What to give your AI assistant so it answers well).
Add the code with Code Injection
- In your site's menu, go to Settings.
- Open Developer Tools (on older menus, Advanced), then Code Injection.
- Paste your embed code into the Footer box.
- Choose Save.
The footer injection is added to the end of every page, which is where chat scripts belong: they load after your content. Open your site in a private window and the chat button should appear in the corner.
Code Block or Code Injection?
Squarespace also has a Code block you can drop into a page. It works, but only on that one page: you'd need one on every page, and a new page wouldn't have the chat until you remembered. Code Injection is set once for the whole site, so use that.
Will it clash with my template?
It shouldn't. The chat draws itself in its own sealed-off area of the page, so your template's styles can't change how it looks, and its styles can't leak into your design. Its colours, greeting and position come from the Widget tab in your Pixexl dashboard, so match its accent colour to your site's there.
Some templates load pages without a full reload when a visitor clicks a link. The chat is added once and stays put as they move around, so this doesn't affect it.
Cookie consent
The chat remembers a visitor's conversation in their browser, so it's covered by your cookie rules. Either keep the chat's own cookie notice (on by default, linked to your privacy policy from the Widget tab), or, if you use Squarespace's cookie banner with a consent tool, turn the chat's notice off, add data-consent="pending" to the script tag and have your consent tool call PixeWidget.grantConsent() when the visitor agrees. Pick one, not both.
It's not showing up: what to check
- You're logged in and editing. Open the site in a private window to see it as a visitor.
- Code Injection is missing from Settings. Your plan doesn't include it.
- The code went into the Header box, or into a page's own Code Injection (under the page's settings). Move it to the site-wide Footer box.
- The domain. If you're on the
squarespace.comaddress, add it to the project's allowed domains. - The chat is switched off. Check that "Show the chat on my site" is on in the Widget tab.
- A typo in the code. Copy the embed code again from the Settings tab rather than retyping it.
If it still won't appear, open your browser's developer console (right-click, Inspect, then Console). The chat leaves a short message there explaining why it didn't load.
After it's live
Ask it the questions your customers ask, read the real conversations once a week, and add forms so a question can turn into a booking or an enquiry without leaving the chat (see How to turn website chats into bookings and enquiries).
Every Pixexl plan includes the assistant, and your first 2 weeks are free, so you can try it on your Squarespace site with real visitors before you decide. Meet Pixe AI to see what it can do.
Squarespace chatbot questions
Which Squarespace plan do I need to add a chatbot?
A plan that includes Code Injection. Squarespace offers it on its paid plans above the entry tier; if you don't see Code Injection in your settings, your plan doesn't include it, and the chat can't be added.
Should I use Code Injection or a Code Block?
Code Injection. A Code Block only adds the code to one page, while the site-wide footer injection shows the chat on every page, with nothing to repeat.
Why doesn't the chat show while I'm editing?
Squarespace's editor doesn't always run injected scripts. Log out, or open the site in a private window, to see it as visitors do.
Does it work with Squarespace Commerce?
Yes. The footer injection covers your shop and product pages too. The assistant answers from your pages and documents, so add your shipping and returns pages as its knowledge; it can't see your orders.
Is there a free trial?
Yes. Every Pixexl plan includes the AI chat assistant, and your first 2 weeks are free, so you can try it on your Squarespace site with real visitors. See pricing for the plans.