# Install on Squarespace

> Add MetricRaven to every page of a Squarespace site with Code Injection.

Source: https://metricraven.com/docs/install-squarespace  
Markdown: https://metricraven.com/docs/install-squarespace.md  
Section: Installation guides

Squarespace's Code Injection adds the tag to the head of every page. It's available on the Core, Plus and Advanced plans and some legacy plans.

1. **Open Code Injection**

   In your site's editor, search for **Code Injection** in the settings (it sits with the custom code and developer tools).

2. **Paste the snippet into Header and save**

   Replace `YOUR_SITE_ID` with the public site ID from your site's **Settings → Install** card. The site ID is public and safe in browser code; never put your secret key in a page.

   ```html title="Header"
   <script
     defer
     src="https://metricraven.com/js/script.js"
     data-site-id="YOUR_SITE_ID"
   ></script>
   ```

   Use the site-wide **Header** field, not a single page's header code injection.

3. **Open your live site**

   Check a page on your public domain in a private window, logged out of Squarespace.

> **Verify it works**
>
> Open your live website in a normal browser window (not an automated or embedded one). In the browser's Network panel, look for `script.js` and then a request to `/api/v1/collect` whose response contains `ok: true`. Open your site's **Traffic** tab and choose **Refresh**; the selected dates must include your visit.
>
> Nothing showing? See [Troubleshooting](https://metricraven.com/docs/troubleshooting).

## Notes

- Squarespace runs injected code in the editor preview too, so your own editing can be counted. Exclude your browser; see [Exclude your visits](https://metricraven.com/docs/exclude-visits).
- Squarespace checkout pages don't run custom code, so checkout steps aren't recorded.
- Use the site-wide head code setting, not an embed or HTML widget: widgets that place code inside an iframe are ignored by the tracker.
- Only hostnames listed in your site's **Settings → General → Site** domains (and their subdomains) are accepted. To also count visits on a platform address such as `your-site.squarespace.com`, add it there; otherwise those requests are refused with `domain_not_allowed`.
- If you use a cookie banner, connect it with [Consent & visitor IDs](https://metricraven.com/docs/consent).

Optional script attributes are listed in [Install & verify](https://metricraven.com/docs/install). To exclude your own visits, see [Exclude your visits](https://metricraven.com/docs/exclude-visits).
