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
- Copy your Fathom Analytics script from your site settings
- Sign in to your Squarespace account
- In the sidebar under the
Utilities section, click Website Tools
- Under the “Custom code” section, click
Code Injection
- Paste your Fathom Analytics script into the
Header text box
- Click
Save
- 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:
- Go to your Squarespace account and in the sidebar under the
Utilities section, click Website Tools
- Scroll down to the
Order Status Page section and add the following code to the text box:
Note: Make sure to replace the dummy Event Name with your desired Event Name in the example below
<script>
window.addEventListener('load', (event) => {
fathom.trackEvent('YOUR EVENT NAME HERE', {
_value: {orderGrandTotalCents},
});
});
</script>
- Click
Save and your event will now start collecting data on each successful order, including the total order price
- 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
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:
- Go to your Squarespace account and click on
Pages
- 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
- Access the thank you page’s settings by clicking the gear icon to the right of it
- In the
General tab, take note of the URL Slug (you will need it later)
- In the Settings menu, click
Advanced and add the following script into the textbox:
Note: Make sure to replace the dummy Event Name with your desired Event Name in the example below
<script>
window.addEventListener('load', (event) => {
fathom.trackEvent('YOUR EVENT NAME HERE');
});
</script>
- Go to the page that contains your form and then edit the page
- Click on your form and then click on the pencil icon to edit the form
- Under the
Content tab, click on the Post-Submit option
- 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)
- 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:
- Go to your Squarespace account and click on
Scheduling
- In the sidebar menu, click on
Integrations
- 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
- In the
HTML Tracking Code textbox, add the following code:
Note: Make sure to replace the dummy Site ID in the “data-site” attribute with your actual Site ID in the example below
<script src="https://cdn.usefathom.com/script.js" data-site="XXXXXX" defer></script>
<script>
window.addEventListener('load', (event) => {
const priceInCents = %price% * 100
fathom.trackEvent('Booking Scheduled', {
_value: priceInCents,
});
});
</script>
- Click
Save Settings
- 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