Squarespace
Install the widget on your Squarespace website
Installing the Widget on Squarespace
Overview
This guide will show you how to install our JavaScript widget on your Squarespace website. Squarespace makes it easy to add custom code through built-in features.
Method 1: Site-Wide Installation (Recommended)
This method adds the widget to all pages of your website.
Step 1: Access Settings
- Log in to your Squarespace account
- Open your website dashboard
- Click Settings in the left sidebar
- Click Advanced
- Click Code Injection
Step 2: Add Your Widget Code
In the Code Injection page, you'll see three sections:
- Header - Code loads in the
<head>of every page - Footer - Code loads at the end of every page (recommended)
- Order Confirmation Page - For e-commerce sites
- Header - Code loads in the
Click in the Footer text box
Paste your widget script:
<script src="https://your-domain.com/widget.js"></script>
<script>
YourWidget.init({
apiKey: 'YOUR_API_KEY'
});
</script>
- Replace
YOUR_API_KEYwith your actual API key from your dashboard
Step 3: Save Changes
- Click Save at the top of the page
- The widget will now appear on all pages of your site
Step 4: Verify Installation
- Visit your live website in a new browser tab
- The widget should be visible on all pages
- If you don't see it, clear your browser cache (Ctrl+Shift+R or Cmd+Shift+R)
Method 2: Single Page Installation
Add the widget to a specific page only.
Step 1: Open Page Settings
- In the Squarespace editor, click Pages in the left sidebar
- Hover over the page where you want to add the widget
- Click the gear icon (⚙️) next to the page name
- Scroll down and click Advanced
Step 2: Add Page Header Code Injection
- In the PAGE HEADER CODE INJECTION field, paste your widget script:
<script src="https://your-domain.com/widget.js"></script>
<script>
YourWidget.init({
apiKey: 'YOUR_API_KEY'
});
</script>
Replace
YOUR_API_KEYwith your actual API keyClick Save at the bottom
Step 3: Publish Changes
- Click Save or Done to exit page settings
- Click the X to close the Pages panel
- The widget will appear on that specific page only
Note: Repeat these steps for each page where you want the widget.
Method 3: Using Code Block
Add the widget to a specific section of a page.
Step 1: Open Page Editor
- Navigate to the page where you want to add the widget
- Click Edit in the top left corner
Step 2: Add Code Block
- Click an Insert Point (the + button that appears between sections)
- Search for or select Code
- A code block will be added to your page
Step 3: Configure Code Block
- Click on the code block to open settings
- In the code editor, paste your widget script:
<script src="https://your-domain.com/widget.js"></script>
<script>
YourWidget.init({
apiKey: 'YOUR_API_KEY'
});
</script>
Replace
YOUR_API_KEYwith your actual API keyMake sure Display Source is turned OFF (this is the default)
Click Apply or click outside the code block
Step 4: Position the Block
- Drag the code block to your desired location on the page
- For best results, place it at the bottom of your page
- Click Save in the top left when done
Installing on Squarespace 7.0 vs 7.1
Squarespace 7.1 (Current Version)
Follow the instructions in Methods 1, 2, or 3 above. All methods work seamlessly.
Squarespace 7.0 (Legacy)
The process is similar:
- Site-wide: Use Settings → Advanced → Code Injection (same as Method 1)
- Page-specific: Use Page Settings → Advanced (same as Method 2)
- Code blocks: Available in most 7.0 templates
Note: Squarespace is phasing out version 7.0. Consider upgrading to 7.1 for better features.
Installing on Squarespace Commerce Sites
For e-commerce websites, you may want the widget on specific pages:
On All Pages (Including Checkout)
Use Method 1 (Code Injection Footer)
On Product Pages Only
- Go to Settings → Advanced → Code Injection
- Add your script to the Footer section with conditional logic:
{.section item}
<script src="https://your-domain.com/widget.js"></script>
<script>
YourWidget.init({
apiKey: 'YOUR_API_KEY'
});
</script>
{.end}
On Order Confirmation Page
- Go to Settings → Advanced → Code Injection
- Paste your widget script in the Order Confirmation Page section
- Click Save
Troubleshooting
Widget Not Appearing
Clear cache:
- Clear your browser cache
- Use Ctrl+Shift+R (Windows) or Cmd+Shift+R (Mac)
- Try viewing in an incognito/private browser window
Verify code placement:
- Check that you pasted the code in the Footer section (not Header)
- Make sure you clicked Save after adding the code
Check for conflicts:
- Disable other custom code temporarily to identify conflicts
- Some themes may have JavaScript conflicts
Verify API key:
- Ensure you replaced
YOUR_API_KEYwith your actual key - Check for extra spaces or estimates
- Confirm the key is correct in your dashboard
- Ensure you replaced
Widget Appears Multiple Times
- You may have added the code in multiple locations
- Check Code Injection (site-wide), Page Settings, and Code Blocks
- Remove duplicate installations
Widget Not Working in Preview
- Custom code may not fully function in Preview mode
- Always test on your published live site
- Publish your changes and test in a new browser tab
Code Block Shows Code Instead of Widget
- Make sure Display Source is turned OFF in the code block settings
- The code block should be in HTML mode, not text or markdown
Best Practices
- Use Method 1 (Code Injection) for site-wide installation - it's the most reliable
- Always test on your live site after publishing
- Use Footer placement instead of Header for better page load performance
- Keep your API key secure - don't share it publicly
- Document your installation - note which method you used
Template Compatibility
The widget works with all Squarespace templates, including:
- Squarespace 7.1 Templates: All current templates (Alameda, Bedford, etc.)
- Squarespace 7.0 Templates: All legacy templates (Brine, Pacific, etc.)
- Commerce Templates: Full support for online stores
- Member Areas: Works in member-only sections
Important Notes
⚠️ Business Plan or Higher Required:
- Code Injection features require a Business plan or higher
- Personal plans have limited code injection capabilities
- Check your plan at squarespace.com/pricing
⚠️ Cache Considerations:
- Squarespace uses caching that may delay widget appearance
- Always hard refresh (Ctrl+Shift+R) when testing
- Changes may take a few minutes to propagate
⚠️ Mobile Responsiveness:
- Test your widget on mobile devices after installation
- The widget should automatically adapt to mobile screens
Squarespace Plan Comparison
| Feature | Personal | Business | Commerce |
|---|---|---|---|
| Code Injection | Limited | ✅ Full | ✅ Full |
| Page-level Code | ❌ No | ✅ Yes | ✅ Yes |
| Order Confirmation Code | ❌ No | ❌ No | ✅ Yes |
Advanced Configuration
Loading Widget After Page Load
For better performance, you can delay the widget loading:
<script>
window.addEventListener('load', function() {
var script = document.createElement('script');
script.src = 'https://your-domain.com/widget.js';
script.onload = function() {
YourWidget.init({
apiKey: 'YOUR_API_KEY'
});
};
document.body.appendChild(script);
});
</script>
Conditional Loading by Page Type
Load widget only on blog posts:
{.section item}
{.if item.categories}
<script src="https://your-domain.com/widget.js"></script>
<script>
YourWidget.init({
apiKey: 'YOUR_API_KEY'
});
</script>
{.end}
{.end}
Need Help?
If you encounter any issues:
- Check our FAQ at [your-support-url]
- Contact support at [your-support-email]
- Include your Squarespace version (7.0 or 7.1) and plan type
- Take screenshots of any error messages
Removing the Widget
To remove the widget from your Squarespace site:
If using Code Injection:
- Go to Settings → Advanced → Code Injection
- Find and delete your widget code from the Footer section
- Click Save
If using Page Header Code:
- Go to Pages
- Click the gear icon next to the page
- Click Advanced
- Delete the code from Page Header Code Injection
- Click Save
If using Code Block:
- Edit the page containing the code block
- Click on the code block
- Press Delete on your keyboard
- Click Save