Report malware
Code injection enables you to enhance your site by adding custom HTML and scripts for features like live chat services, domain verification, and analytics.
Important Notes Before Using Code Injection:
- Scripts may need to be disabled while editing
- JavaScript must be wrapped in
<script>
tags - CSS should preferably go in the Custom CSS Editor
- Ajax loading might prevent CSS from loading properly
- Checkout pages don't support injected code
Adding Code to Different Sections:
Header
- Inserts code into the
<head>
tags of all pages - Best for site-wide scripts and integrations
Footer
- Adds code before the closing
</body>
tag - Useful for analytics and tracking codes
Lock Page
- Appears above password field on protected pages
- Recommended to use Lock Screen panel instead
Order Pages Available tags for order-related pages:
{orderId}
: Order number{orderSubtotal}
: Order subtotal{orderGrandTotal}
: Total order amount{customerEmailAddress}
: Customer's email
Page-Specific Injection:
- Hover over page in Pages panel
- Click settings icon
- Add code in "Code Injection to Page Header"
- For blogs, use "Code Injection for Blog Post Items"
Cookie Banner Integration:
- Enable Cookie Banner in settings
- Choose "Opt-in and Opt-out" type
- Add conditional code for third-party integrations
- Save changes
Warning mark in a red circle
Troubleshooting:
- Use "/safe" at URL end to disable scripts
- Test in incognito mode to view custom code
- Remove problematic code temporarily while troubleshooting
- Consider consulting a Squarespace Expert for complex customizations
Remember to always backup your code before making changes and test thoroughly in preview mode before publishing.