Before you start
Create a free Cool Analytics account and add your site. You'll get a site ID — replace YOUR_SITE_ID in the code below with it. The dashboard shows the snippet with your ID already filled in.
Install on Squarespace
- 1Open your site and go to Website → Pages, then Website Tools → Code Injection (older menus: Settings → Advanced → Code Injection).
- 2Paste the snippet into the Header field.
- 3Click Save. It's live on the next page load.
<script defer src="https://coolanalytics.dev/hb.js" data-site="YOUR_SITE_ID"></script>
Check that it works
Open your live site in a new tab, then open your Cool Analytics dashboard. Your visit appears on the live map within seconds — with the page you're on, where you came from and your browser.
Nothing showing up? Make sure you're looking at the published site (not a preview or editor), that an ad blocker isn't blocking the script, and that you're not testing on localhost.
Track signups, purchases and clicks
Pageviews, sources, countries and outbound link clicks are tracked automatically. For the moments that matter to you, send a custom event. Events named like a signup show up as signups, and events with an amount show up as revenue — on the live map and per traffic source.
// anywhere in your Squarespace site's browser code
window.hb?.track("signup");
// with an amount, it shows up as revenue
window.hb?.track("purchase", { amount: 49 });Squarespace tips
- Code Injection isn't available on Squarespace's Personal/Basic plans — you need Business/Core or higher.
- Scripts don't run in the editor preview; check your live site in a private window.
Want to keep your own visits out of the stats? Open your site once with #hb-ignore at the end of the URL. That browser is excluded until you visit with #hb-track.
Squarespace analytics FAQ
Does it work during the free trial?+
Code Injection is a premium feature, so it may be unavailable until you're on an eligible paid plan.
Will it track Squarespace Commerce checkout?+
Checkout runs on Squarespace's secure pages, where site code injection doesn't apply. Product and cart pages are tracked.
Can I add it to one page only?+
Each page has its own code injection under its settings, but site-wide header injection is what you want for analytics.