Sign inFree trial
Support home / Integrations

Squarespace analytics

Adding the Fathom script to your Squarespace website is a quick and easy process. Here's how to set up your Squarespace site to work with our analytics:

Setting up the script

  1. Copy your Fathom Analytics script from your site settings
  2. Sign in to your Squarespace account
  3. In the sidebar, click on Settings > Developer Tools > Code Injection
  4. Paste your Fathom Analytics script in the Header textbox:
    Add the Fathom script to the Header
  5. Click Save
  6. To check the script is working, head over to your site and then check your Fathom dashboard to see if your visit was recorded

Collecting data for purchases

If you would like to capture sales data, you can do so using events. Here's how:

  1. First, in Fathom, create an event for your site and make a note of the Event ID provided
  2. Go to your Squarespace account and click on Settings > Developer Tools > Code Injection
  3. Scroll down to the Order Status Page section and add the following code to the textbox:

Note: Make sure to replace the dummy Event ID in the example with your Event ID

<script>
window.addEventListener('load', (event) => {
fathom.trackGoal('YOUR-EVENT-ID', {orderGrandTotalCents});
});
</script>
  1. Click Save and your event will now start collecting data on each successful order, including the total order price
  2. To check if your event is working, create a successful order and navigate to the order status page. Once you have done that, check your Fathom dashboard to see if the event completion and the relevant value was recorded

Collecting data for form submissions

If you would like to capture how many form submissions you receive, you can also do that using events. The easiest method of doing that is by redirecting form submissions to a 'thank you' page, where you can trigger the event on page load. Here's how:

  1. First, in Fathom, create an event for your site and make a note of the Event ID provided
  2. Go to your Squarespace account and click on Pages
  3. If your forms don't already have a thank you page to which submissions redirect, you will need to create one. To create a thank you page, click the '+' button in the Not Linked section, select a page template, and give the page a name
  4. Access the thank you page's settings by clicking the gear icon to the right of it
  5. In the General tab, take note of the URL Slug (you will need it later)
  6. In the Settings menu, click Advanced and add the following script into the textbox:

Note: Make sure to replace the dummy Event ID in the example with your Event ID

<script>
window.addEventListener('load', (event) => {
fathom.trackGoal('YOUR-EVENT-ID', 0);
});
</script>
  1. Go to the page that contains your form and then edit the page
  2. Click on your form and then click on the pencil icon to edit the form
  3. Under the Content tab, click on the Post-Submit option
  4. Click on the Redirect tab, and in the Redirect URL field, add the URL Slug that you made a note of earlier (i.e., /thank-you)
  5. To check if your form submission event is working, navigate to the page your form is on and submit it. Once you have done that, check your Fathom dashboard to see if the form's event completion was recorded

Collecting data for bookings

If you would like to capture how many bookings you receive using Squarespace's Scheduling feature, you can also do that using events. Here's how:

  1. First, in Fathom, create an event for your site and make a note of the Event ID provided
  2. Go to your Squarespace account and click on Scheduling
  3. In the sidebar menu, click on Integrations
  4. Click on the Analytics & Conversion Tracking tab, and under Custom Conversion Tracking, if you don't already have it set up, click Set up. If you do already have it set up, click Edit
  5. In the HTML Tracking Code textbox, add the following code:

Note: Make sure to replace the dummy SiteID and Event ID in the example with your Event ID

<script src="https://cdn.usefathom.com/script.js" data-site="XXXXXX" defer></script>
<script>
window.addEventListener('load', (event) => {
const priceInCents = %price% * 100
fathom.trackGoal('MARHXPEX', priceInCents);
});
</script>
  1. Click Save Settings
  2. To check if your booking event is working, navigate to your scheduling page and book an appointment. Once you have done that, check your Fathom dashboard to see if the form's event completion and the relevant value was recorded

If you still have questions or require help with anything, please reach out to us and we'll happily get things sorted out for you.