Back to Installation

Squarespace Installation Guide

Step-by-step guide to install TwoBucks Analytics on Squarespace.

Quick Start

Method 1: Code Injection (Recommended)

  1. Go to Settings → Advanced → Code Injection
  2. 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

  1. Add a Code block to your page
  2. 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

  1. Ensure script is in Settings → Code Injection → Header
  2. Check that you're using the correct site (not template)
  3. Verify data-website-id is 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

Next Steps