You can add custom code and scripts to your site using the Code Injection area in Website Settings.
When to use Code Injection
Before you begin
- Creating and adding code to Code Injection is an advanced modification that requires programming knowledge. Squarespace doesn't provide code-based support.
- Code added to Code Injection fields will apply to all your site pages, regardless of any styles or style overrides you're using. Unlike Squarespace 7, Squarespace 5 doesn't support per-page code injection.
- For best results, keep the total amount of code in your Code Injection areas under 32,000 characters. If you go over this limit, it may trigger a Whoops error.
- You can add code within the <head> tag using the Extra Header Code field for every Squarespace 5 site. You must be on the Unlimited plan to access all ten code injection points (as shown in the screenshot below).
Step 1 - Open Code Injection
- Log into your site and open the Website Management bar.
- Cick Website Settings under Structure.
- Go to the Code Injection tab.
Step 2 - Add HTML code
Select an Injection Region from the drop-down.
Note: If you're not on the Unlimited plan, you can only access the Extra Header Code injection region.
Paste your code into the HTML Code field.
Step 3 - Save
Click Update Information.
Once you add code to an injection region's code field, the drop-down for that region will include an Edited flag.
If you're seeing an error message and you've confirmed that your code is valid, try adding it to your site using one of our other options for custom code. Only Code Injection has this built-in validation tool.
For more modern and robust Code Injection options, including per-page injection, consider switching to our current platform, Squarespace 7. You can read about Squarespace 7's Code Injection options on our Squarespace 7 help site. When you're ready to switch, visit Moving from Squarespace 5 to Squarespace 7.0 or Moving from Squarespace 5 to Squarespace 7.1.
Note: Adding or modifying code on your site is an advanced modification. We highly recommend that you have coding knowledge to use Code Injection. While we can't offer more help on this topic, here are some resources to point you in the right direction: