Back to Installation
Squarespace Installation Guide
Step-by-step guide to install TwoBucks Analytics on Squarespace.
Quick Start
Method 1: Code Injection (Recommended)
- Go to Settings → Advanced → Code Injection
- Add the script to the Header section:
<script
src="https://twobucks.ai/script.js"
data-website-id="your-website-id"
async
></script>Method 2: Code Block
- Add a Code block to your page
- Paste the script:
<script
src="https://twobucks.ai/script.js"
data-website-id="your-website-id"
async
></script>Note: Code blocks are page-specific. For site-wide tracking, use Code Injection.
Track Squarespace Events
Button Clicks
Add a Code block with tracking:
<script>
document.addEventListener('DOMContentLoaded', function() {
const buttons = document.querySelectorAll('a[href*="/contact"]');
buttons.forEach(function(button) {
button.addEventListener('click', function() {
if (window.twobucks) {
window.twobucks('button_click', {
button_text: 'Contact',
page: window.location.pathname
});
}
});
});
});
</script>Form Submissions
Squarespace forms can be tracked via form block settings or custom code:
<script>
document.addEventListener('DOMContentLoaded', function() {
const forms = document.querySelectorAll('form[action*="squarespace.com"]');
forms.forEach(function(form) {
form.addEventListener('submit', function() {
if (window.twobucks) {
window.twobucks('form_submit', {
form_name: 'Contact Form',
page: window.location.pathname
});
}
});
});
});
</script>Common Issues
Script Not Loading
- Ensure script is in Settings → Code Injection → Header
- Check that you're using the correct site (not template)
- Verify
data-website-idis correct
Code Block Limitations
- Code blocks are page-specific
- Use Code Injection for site-wide tracking
- Some templates may have limited code support
Squarespace 7.0 vs 7.1
- 7.0: Use Code Injection in Settings → Advanced
- 7.1: Use Code Injection in Website → Pages → Website Tools → Code Injection