# What Is Squarespace Code Injection, and Which Plan Has It?

Canonical: https://figment.so/blog/squarespace-code-injection

Code Injection adds custom HTML or scripts to your header, footer, pages, blog posts, lock screen and post-checkout pages. It needs the Core, Plus or Advanced plan (or some legacy plans), not Basic.

**Squarespace Code Injection adds custom HTML or scripts to the site-wide header and footer, individual pages, blog posts, the password lock screen, and the order confirmation and order status pages.** It is available on the Core, Plus, Advanced and some legacy plans, not Basic. It does not work on checkout pages, and Squarespace support will not troubleshoot code you add.

## Where can I add code with Code Injection?

Code Injection is a panel with several fields, and each one injects into a different part of the site. Per Squarespace's help article ([Squarespace, "Customize parts of your site with code injection"](https://support.squarespace.com/hc/en-us/articles/205815908-Using-code-injection)):

| Field | Where the code lands |
| --- | --- |
| Header | "injected into the `<head>` tag on every page in your site" |
| Footer | "injected before the closing `</body>` tag on every page in your site" |
| Page Header Code Injection | the `<head>` tag of that one specific page only |
| Post Blog Item Code Injection | added to every blog post |
| Lock page | "displays above the lock screen's password field" of a password-protected site or page |
| Order confirmation page | runs after checkout for gift cards, memberships, and subscriptions |
| Order status page | runs after checkout for physical products, download products, and service products |

If you run analytics or a tracking pixel on purchase confirmation, the field that fires depends on what the customer bought, not on one "thank you page." Squarespace provides six merge tags for the order pages so a script can reference the actual order: `{orderId}`, `{orderSubtotal}`, `{orderSubtotalCents}`, `{orderGrandTotal}`, `{orderGrandTotalCents}` and `{customerEmailAddress}`.

## Which Squarespace plan includes Code Injection?

Core, Plus, Advanced and some legacy plans. Squarespace states: "Code injection is available in the Core, Plus, Advanced, and some legacy billing plans" (same source). Basic is not on that list. Our [Squarespace pricing guide](/blog/squarespace-pricing) covers the full Basic-through-Advanced breakdown, and [Squarespace's pricing page](https://www.squarespace.com/pricing) shows the current lineup, since plans change.

## What can't Code Injection do?

Squarespace's help center states three limits:

- **Checkout pages are off-limits.** "Can I add code to checkout pages? No. You can't add custom code to checkout pages." To track add-to-cart or checkout-start events, you need a solution that fires earlier or later in the funnel.
- **CSS has a better home.** Code Injection accepts CSS wrapped in `<style>` tags, but Squarespace recommends against it: "Yes, but we recommend using the Custom CSS Editor instead of code injection." On version 7.0 sites, the page also warns that "Ajax loading may prevent CSS added to code injection from loading correctly." See [Squarespace custom CSS](/blog/squarespace-custom-css).
- **The Lock page has a trial restriction.** You "can't inject code to the lock screen during your site's trial period," so test a password-page change after the site is on a paid plan.

## Does Squarespace support code I add?

No. Squarespace's help center states: "We don't provide support for code-based modifications, unless otherwise specified. This means that we're unable to help further with setup or troubleshooting" ([Squarespace, "Code-based customizations"](https://support.squarespace.com/hc/en-us/articles/216107348-Code-based-customizations)). It adds: "Since these are code-based solutions, we can't guarantee their functionality or full compatibility with Squarespace," including "their appearance on mobile devices," and concludes that "unlike our official integrations, all code-based customizations fall outside of the scope of Squarespace support."

The Code Injection page repeats the warning: "Custom code might break your site's appearance or behavior, especially on mobile devices. Our support team can't help you add custom code to your site or troubleshoot issues that arise from using it." If a script breaks your mobile layout or conflicts with a template update, fixing it is up to you or whoever wrote the code. Squarespace points you to the Squarespace Forum or a paid Squarespace Expert.

## How do I add code to my site?

Use the Header or Footer field for site-wide code:

1. Open the Code Injection panel (**Website → Website Tools → Code Injection** on most current plans).
2. Paste valid HTML or scripts into the Header or Footer field. Wrap any JavaScript in `<script></script>` tags.
3. Click **Save**.

For a single page, hover over that page in the Pages panel, click the settings icon, then **Advanced**, and add code to that page's own header field. For a script that should run on every blog post, use the Post Blog Item Code Injection field in the blog's page settings.

**Example (hypothetical):** A site owner wants a heat-mapping script to load site-wide but fire tracking only after a visitor accepts cookies. They add the script to the site-wide Footer field, enable the cookie banner under **Cookies & Visitor Data**, and wrap the tracking call so it runs only after consent. This is an illustrative pattern, not a test we ran.

## What do I do if injected code breaks my site editor?

Use Squarespace's script toggle. If a script interferes with editing, a banner appears at the bottom of your site reading "We detected an error loading your site preview. This is usually caused by injected code." From there:

- Click **Disable Scripts in Preview** to turn off your injected code while you keep editing. This does not change what visitors see on the live site, only your own preview.
- If the banner is not showing but the editor still will not load properly, type `/safe` directly after `/config` at the end of your secure editing URL and press Enter to force scripts off.
- To see the site as a visitor would, with your code still running, open the live URL in a private or incognito browser window.
- To turn the script back on, click **Enable Scripts in Preview** from the same banner.

Because the toggle affects only your editing session, you can use it to tell whether a layout problem comes from your theme, a template change or your added code, without deleting the code.
