Browse all docs

Install the widget

Install on Squarespace

Add the SiteTrellis chat widget to Squarespace through Code Injection, with plan requirements, per-page options, and preview caveats.

Last updated:

Squarespace supports site-wide scripts through Code Injection. This feature is available only on Business plans or higher (and the commerce plans). Squarespace's menus change between versions, so use the steps below as a guide and see the Squarespace Help Center for the current layout.

Requirements#

  • A Squarespace plan that includes code injection (Business or higher at the time of writing).
  • A SiteTrellis site with a published agent, and the embed snippet from the dashboard. See the quickstart.
  • Your live address in the SiteTrellis site's Allowed origins, for example https://www.example.com. If your site is also reachable at https://your-site.squarespace.com, add that origin too if you plan to test there.

Add the snippet site-wide#

  1. Open your site's Settings panel from the Squarespace home menu.
  2. Go to Advanced and choose Code Injection.
  3. Paste the SiteTrellis snippet into the Footer box. The footer injection is placed at the end of the page, which is where the widget script belongs.
  4. Click Save.
  5. Open your live site (not the editor) in a private window and hard-refresh.
<script src="https://cdn.sitetrellis.com/v/a44108d9c4521120/widget.js" data-site="site_xxxxxxxx" async></script>

Only on certain pages#

Squarespace also offers per-page code injection: open the page's settings (the gear icon next to the page in Pages), then Advanced, and paste the snippet into the page header injection box. Use this when you only want chat on a pricing or contact page. A simpler alternative that works for the whole site is to use the SiteTrellis page rules (include and exclude URL patterns) so you can change where the widget appears without editing Squarespace again. See Widget customization.

Do not use a Code Block for this. A Code Block only affects the page it sits on, so the widget would be missing everywhere else.

Editor and preview caveats#

  • Squarespace generally does not run injected code while you are logged in and editing, or inside the editor preview. This is intentional, to keep the editor stable. Test on the live URL while logged out or in a private window.
  • Trial sites with a Squarespace-provided address can behave differently from your connected domain, mainly because the origin is different. Make sure whichever origin you test from is in the allowed list.
  • Squarespace versions 7.0 and 7.1 both have Code Injection, but the settings may live in slightly different places.

Identify logged-in members (optional)#

Squarespace member areas do not expose the visitor's profile to page scripts in a standard way, so identifying members usually requires custom work. You can always have the agent ask for a name and email in the conversation, or use the pre-chat form. See Lead capture.

Common issues#

SymptomFix
No Code Injection optionYour plan does not include it. Upgrade the Squarespace plan.
Widget not visible on the live siteCheck that the agent is published, that you are testing logged out or in a private window, and that the origin is allowed.
Widget shows on some pages but not othersYou may have used page-level injection or page rules that exclude those pages.
Changes not showingSquarespace caches pages briefly. Wait a minute and hard-refresh.
Help from Squarespace Search the Squarespace Help Center for "code injection" for current instructions and plan requirements.