> ## Documentation Index
> Fetch the complete documentation index at: https://docs.crispstats.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> CrispStats is a hosted, privacy-first web analytics product. It has no self-hosted edition, no session replay, no heatmaps, no A/B testing, no mobile SDKs and no data import except a site's history from a Plausible export (Settings, Import and export).
> The script global is crispstats(...), site keys start with cs_pk_ and secret API keys start with cs_sk_. The script is served from https://in.crispstats.com/d.js and the REST API lives at https://crispstats.com/api/v1.
> There is no npm package to install. Integrations copy the script tag, the queue stub, crispstats.d.ts and proxy code from these docs or from Settings, Tracking code in the dashboard. A first-party proxy forwards one path of the site to https://in.crispstats.com/p/ and forwards only content-type, user-agent, accept-language, referer, origin, if-none-match and x-forwarded-for, never cookies.

# Install CrispStats on Squarespace

> Add the CrispStats script to a Squarespace site through the Code Injection panel's Header field. Code injection is on the Core, Plus and Advanced plans.

To install CrispStats on Squarespace, paste the script tag into the **Header** field of the Code Injection panel and save. Squarespace adds that code to the `<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**

```html theme={"theme":{"light":"github-light","dark":"github-dark"}}
<script
  defer
  data-site="cs_pk_xxxxxxxx"
  data-domains="example.com"
  src="https://in.crispstats.com/d.js"
></script>
```

Replace the key with yours and `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.

> [!NOTE]
>
> 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.js` load from `in.crispstats.com` and a `POST` to `https://in.crispstats.com/e` that gets `202`.
* 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_xxxxxxxx` with 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:

```html theme={"theme":{"light":"github-light","dark":"github-dark"}}
<script
  defer
  data-site="cs_pk_xxxxxxxx"
  data-domains="example.com"
  data-outbound
  data-downloads
  src="https://in.crispstats.com/d.js"
></script>
```

`data-outbound` counts clicks to other sites and `data-downloads` counts links to files such as PDFs. See [script attributes](https://docs.crispstats.com/tracking/script-attributes.md).

## Send custom events

Where you can add your own HTML to a page, put `data-cs-event` on a link or button to count clicks:

```html theme={"theme":{"light":"github-light","dark":"github-dark"}}
<a href="/book" data-cs-event="booking click" data-cs-prop-place="home">Book a session</a>
```

To count form submissions, make the page visitors land on after the form a goal with a **Page visit** rule. See [goals](https://docs.crispstats.com/dashboard/goals.md) and [declarative events](https://docs.crispstats.com/track/declarative-events.md).

## FAQ

> [accordion] 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.

> [accordion] 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](https://docs.crispstats.com/revenue/payment-api.md).

> [accordion] Do I need a cookie banner for CrispStats?
>
> By default the script sets no cookie and stores nothing on the visitor's device. See [compliance](https://docs.crispstats.com/privacy/compliance.md). This is not legal advice.

## Next steps

> [card] [Goals](https://docs.crispstats.com/dashboard/goals.md)
>
> Count thank-you pages and clicks as conversions.

> [card] [Outbound links and downloads](https://docs.crispstats.com/track/outbound-links-and-downloads.md)
>
> Count clicks to other sites and file downloads.

> [card] [Troubleshooting](https://docs.crispstats.com/help/troubleshooting.md)
>
> What to check when no events arrive.

> [!NOTE]
>
> 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](https://support.squarespace.com/hc/en-us/articles/205815908-Using-code-injection), read on 2026-11-23.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.