Home/Blog/how-to-add-chatbot-to-squarespace
Squarespace Integration

How to Add an AI Chatbot to Squarespace (Code Injection Guide)

Learn how to install an autonomous AI customer support chatbot on Squarespace 7.1 or 7.0 in under 3 minutes. Step-by-step instructions for Footer Code Injection, inline container embedding, and automated sitemap crawling.

Updated November 2026Tested on Squarespace 7.1 Fluid EngineZero Impact on Lighthouse Core Web Vitals
Squarespace Plan Requirement: Business Plan or Higher

Squarespace explicitly locks external JavaScript and the Code Injection tool on the entry-level Personal plan. To embed Knogents (or any third-party script), your Squarespace site must be on a Business, Commerce (Basic/Advanced), or Enterprise plan. If you are currently on a Personal plan, you will need to upgrade inside your Squarespace billing settings before proceeding.

Step 1: Configure Your Chatbot Parameters in Knogents

Before copying the script into Squarespace, set up your agent in the Knogents dashboard with these production-tested parameters:

How to Add an AI Chatbot to Squarespace (Code Injection Guide)
ParameterRecommended SettingTechnical Reason
Display Modefloating or inlineChoose floating for a site-wide corner bubble, or inline if embedding inside a dedicated Support page layout.
Confidence Threshold0.72 – 0.78Prevents hallucinating answers when user questions are not covered in your Squarespace pages.
Knowledge SourcesSitemap + PDF SpecsPoint Knogents to https://yourdomain.com/sitemap.xml to auto-ingest all published pages and blog posts.
Lead EscalationEmail AlertsConfigure your notification email for instant lead capture and conversation transcripts.

Step 2: Choose Your Installation Method

AMethod 1: Site-Wide Floating Chatbot (Footer Code Injection)

This is the standard installation for having a floating chat bubble appear across all pages of your Squarespace site:

  1. Log in to your Squarespace Account and open your website manager.
  2. In the left sidebar, navigate to Website Tools > Code Injection (In Squarespace 7.0, navigate to Settings > Advanced > Code Injection).
  3. Scroll down past the Header box to the FOOTER code injection area.
  4. Paste your Knogents script tag into the FOOTER field:
<script
  async
  src="https://knogents.com/embed.js"
  data-agent-id="YOUR_AGENT_ID">
</script>
Why Footer instead of Header?

Injecting the script in the Footer ensures your HTML DOM, CSS styles, and hero images finish rendering first. The async attribute ensures Knogents loads non-blockingly without delaying your site's Largest Contentful Paint (LCP).

Click Save in the top left corner of the Code Injection panel.
BMethod 2: Inline Embedded Chat (Code Block on a Specific Page)

If you prefer embedding the chat interface directly into the layout of a dedicated "Support" or "Contact" page instead of a floating bubble:

  1. Edit the target Squarespace page in the page editor.
  2. Click Add Block and select the Code block.
  3. In the Code block settings panel, set the language dropdown to HTML and make sure Display Source is toggled OFF.
  4. Paste the following container snippet:
<!-- Knogents Dedicated Inline Support Portal -->
<div id="rag-inline-bot" style="min-height: 540px; width: 100%; border-radius: 12px; overflow: hidden;"></div>
<script
  async
  src="https://knogents.com/embed.js"
  data-agent-id="YOUR_AGENT_ID">
</script>

The Knogents loader detects the presence of the #rag-inline-bot container and automatically renders the chat interface directly inside the block rather than as a floating corner button.

Step 3: Verification & Squarespace Quirks

1. Editor Preview Mode Disables Scripts

Squarespace deliberately turns off custom injected scripts while you are editing sections in Fluid Engine. Do not worry if the chat widget does not show up inside the editor. Open your published website URL in a separate private or incognito window to see the live bot.

2. Squarespace Ajax Page Loading (Version 7.0)

Some older Squarespace 7.0 templates use Ajax page loading (PJAX), which switches page content without a full browser reload. Knogents' loader script (embed.js) includes built-in MutationObserver hooks and listens for Squarespace's internal navigation events (mercury:load), ensuring the chat widget persists smoothly across page clicks.

3. Automated Sitemap Re-indexing

Whenever you publish new blog posts or modify page text in Squarespace, Knogents automatically re-indexes your site based on your plan schedule (Weekly on Basic, Daily on Standard). You can also click "Sync Now" in the Knogents dashboard to trigger an immediate crawl.

Frequently Asked Questions

Does Knogents slow down my Squarespace website?

No. The Knogents embed script is under 18KB gzipped and loads asynchronously from global edge CDNs. Because it runs after your initial DOM content loads, it does not impact your Google Lighthouse or Core Web Vitals speed scores.

Can I style the chatbot colors to match my Squarespace theme?

Yes. In the Knogents dashboard, you can customize the primary brand color, header avatar, greeting message, and launcher icon without writing any CSS.

Add an AI Chatbot to Your Squarespace Site Today

Start with 100 free messages. Ingest your Squarespace sitemap, customize your widget, and paste the 1-line script.

Recommended Business Solutions

Discover autonomous AI solutions powered by these installation techniques.

Related Guides & Tutorials

Continue exploring practical guides to embedding and training your chatbot.

24/7 STOREFRONT ASSISTANT

Ready to Build Your AI Agent?

Train an AI chatbot on your website URLs, PDFs, and spreadsheets in 2 minutes with verified factual accuracy.

Free tier includes 100 messages/mo
No credit card required
Under 20 KB vanilla script