Skip to content

Site builders

Squarespace analytics with CrispStats

Squarespace analytics with CrispStats is one script tag in the Header field of the Code Injection panel, saved once. Squarespace adds it to the head of every page, and code injection is available on the Core, Plus, Advanced and some legacy billing plans.

Updated

Set up CrispStats on Squarespace

  1. 01

    Step 1: Check that your plan has code injection

    Squarespace’s help page on code injection says it “is available in the Core, Plus, Advanced, and some legacy billing plans”. On a plan without it there is no site-wide place for a script tag.

  2. 02

    Step 2: Copy the tag with your key

    In the CrispStats dashboard, open your site’s Settings, select Tracking code and copy the tag from the HTML tab. Replace example.com with your domain if it is not filled in. Only hostnames in data-domains, and their subdomains, are counted, so visits to a built-in Squarespace address are left out unless you add it.

    Replace the highlighted values with your own.

    <scriptdeferdata-site="cs_pk_your_site_key"data-domains="example.com"src="https://in.crispstats.com/d.js"></script>
  3. 03

    Step 3: 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 in its Advanced settings, so every page is covered.

  4. 04

    Step 4: Test in a private window

    Squarespace lets you disable scripts in the editor preview when injected code gets in the way, so the editor is not a reliable place to test. Open your live site in a private window instead.

  5. 05

    Step 5: Turn on extra events (optional)

    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:

    <scriptdeferdata-site="cs_pk_your_site_key"data-domains="example.com"data-outbounddata-downloadssrc="https://in.crispstats.com/d.js"></script>
  6. 06

    Step 6: Count a click (optional)

    Where you can add your own HTML to a page, for example in a code block, put data-cs-event on a link or button, with properties from data-cs-prop- attributes.

    <a href="/book" data-cs-event="booking click" data-cs-prop-place="home">Book a session</a>

Check that it works

Open your live site in a private window with the developer tools on the Network tab. You should see d.js load from in.crispstats.com and a POST to /e that gets 202. Click through a few pages: each sends another POST, and the pages appear on the Realtime screen within seconds. The status row on the CrispStats Tracking code tab shows Receiving events. once the first event is stored.

What the install check shows once the first events land, on the demo site, Quillbook, on generated traffic.
  • What you get

    • Pageviews, unique visitors and sessions for every page that takes code injection, including blog posts and product pages.
    • Sources and channels: search, social, newsletters tagged with UTM parameters, and visits from AI assistants such as ChatGPT and Perplexity.
    • Entry and exit pages, countries, devices and browsers, with no cookies and no IP addresses stored.
    • Bookings and form submissions as goals: make the page visitors land on after the form a goal with a Page visit rule.
    • Optional web vitals and JavaScript errors from real visits, switched on with data-vitals and data-errors.
  • Notes and limits

    • Squarespace says checkout pages do not support code, so the script does not run during checkout. Pageviews on the rest of the site are counted as usual.
    • There is no Squarespace integration for orders. You can report payments from a server you run with the payment API; CrispStats has no product, inventory or margin reports.
    • If your template changes pages without a full reload and the URL changes through the History API, each new URL counts as a pageview too. The same URL twice in a row is one pageview.
    • Squarespace cannot run the forwarding rule that serves the script from your own domain, so the script loads from in.crispstats.com and visitors whose ad blocker stops that host are not counted. See the proxy guide for what the rule needs.

The docs page covers the optional steps this guide leaves out.

Setup questions. Straight answers.

What people ask before they connect it.

  • 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 tag.

  • Not automatically. Squarespace checkout pages do not support custom code, and there is no built-in integration. You can report payments from your own server with the payment API.

  • The editor preview is not a reliable place to test, because scripts can be disabled there. Open the live site in a private window on your own domain.

  • CrispStats sets no cookies and stores nothing on the visitor's device by default. Squarespace and other scripts on your site may, so check the whole site. This is not legal advice.

  • CrispStats is billed apart from Squarespace, by monthly events only. Every account starts with a 14-day free trial with every feature and no card; then Starter is $5 a month for 250,000 events. The Squarespace side still needs a plan with code injection.

Not answered here? Write to hello@crispstats.com

Go further

Related

Your traffic, crisp and clear

One script, no cookies, and every feature from the first day. Set up takes about as long as pasting a snippet.