<head> of every page. Code injection is available on the Core, Plus and Advanced plans and some legacy billing plans, according to Squarespace’s help page.
You need your site’s public key, which starts with cs_pk_. Find it in CrispStats under Settings, Tracking code, on the HTML tab. The key is safe to publish.
Add the script
1
Copy the tag
example.com with your domain. Only hostnames in data-domains, and their subdomains, are counted. If the site is also reachable on a built-in Squarespace address, leave it out to ignore those visits, or add it to count them.2
Paste it into Header
Open the Code Injection panel of your site, paste the tag into the Header field and select Save. Use the site-wide Header field, not a single page’s header injection, so every page is covered.
3
Open your live site
Open your site in a private window. Squarespace’s help page notes that scripts can be disabled in the editor preview, so the editor is not a reliable place to test. The status row on the CrispStats Tracking code tab shows Receiving events. once the first event has been stored.
Squarespace says you cannot add custom code to checkout pages, so the script does not run during checkout. Pageviews on the rest of the site are counted as usual.
Check that it works
- Open your live site in a private window with the browser’s developer tools on the Network tab. You should see
d.jsload fromin.crispstats.comand aPOSTtohttps://in.crispstats.com/ethat gets202. - Click through a few pages. Each page sends another
POST, and the pages appear in CrispStats Realtime within seconds. - Open
https://in.crispstats.com/check?k=cs_pk_xxxxxxxxwith your key."site": "known"means the key is right.
How page changes are counted
A full page load counts once. If your template changes pages without a full reload and the URL changes through the History API, the script counts each new URL as a pageview too. The same URL twice in a row is one pageview, so clicking through pages in the check above shows whether each one arrives.Add optional modules
Add attributes to the tag in the Header field and save:data-outbound counts clicks to other sites and data-downloads counts links to files such as PDFs. See script attributes.
Send custom events
Where you can add your own HTML to a page, putdata-cs-event on a link or button to count clicks:
FAQ
Which Squarespace plans can add the script?
Which Squarespace plans can add the script?
Squarespace’s help page lists code injection on the Core, Plus and Advanced plans and some legacy billing plans. On a plan without code injection, there is no site-wide place for the script tag.
Can CrispStats record Squarespace Commerce orders?
Can CrispStats record Squarespace Commerce orders?
Not automatically: there is no Squarespace integration, and custom code does not run on checkout pages. You can report payments from your own server with the payment API.
Next steps
Goals
Count thank-you pages and clicks as conversions.
Outbound links and downloads
Count clicks to other sites and file downloads.
Troubleshooting
What to check when no events arrive.
Squarespace details (the Header field of the Code Injection panel, which plans include code injection, no custom code on checkout pages and scripts in the editor preview) are from Squarespace’s help page “Customize parts of your site with code injection”, https://support.squarespace.com/hc/en-us/articles/205815908-Using-code-injection, read on 2026-11-23.