> ## 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 Ghost

> Add the CrispStats script to a Ghost publication with Settings, Advanced, Code injection: paste the tag into Site header and save. No theme edit needed.

To install CrispStats on Ghost, paste the script tag into the **Site header** box under **Settings**, **Advanced**, **Code injection** in Ghost Admin and save. Ghost outputs that code inside `<head>` on every page of your site, so you do not need to edit your theme.

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 publication's domain.

**2. Paste it into Site header**

In Ghost Admin, open **Settings**, go to **Advanced**, then **Code injection**. Paste the tag into **Site header** and save. Use the site-wide box, not the code injection of a single post, so every page is covered.

**3. Open your site**

Open your publication in a private window, signed out. The status row on the CrispStats **Tracking code** tab shows **Receiving events.** once the first event has been stored.

> [!NOTE]
>
> Ghost's help page for code injection does not mention a plan requirement. If you use Ghost(Pro) and do not see **Code injection**, check what your plan includes with Ghost.

## Check that it works

* Open a post 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`.
* Open the page source and search for `in.crispstats.com/d.js`. If it is missing, your theme may not output Ghost's head code: themes must include `{{ghost_head}}` in their default layout.
* In CrispStats, the visit appears in **Realtime** within seconds.

## How page changes are counted

Each Ghost page is a full page load, so the script counts one pageview per post or page. A change that only touches the part of the URL after `#`, such as a pop-up that opens over the page, is not a separate pageview: the script drops the fragment unless the tag has `data-hash`, which a Ghost site does not need. If your newsletter links carry UTM parameters, the script keeps them and the campaign shows under **Sources**. See [traffic channels](https://docs.crispstats.com/concepts/metrics.md#traffic-channels).

## Add optional modules

Add attributes to the tag in **Site header** 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-404
  src="https://in.crispstats.com/d.js"
></script>
```

`data-outbound` counts clicks to other sites. `data-404` sends a `404` event on not-found pages that carry the marker, see [404 pages](https://docs.crispstats.com/track/404-pages.md). [Script attributes](https://docs.crispstats.com/tracking/script-attributes.md) lists the rest.

## Send custom events

Inside a post, an HTML card can carry a `data-cs-event` link or button:

```html theme={"theme":{"light":"github-light","dark":"github-dark"}}
<a href="https://example.com/course" data-cs-event="course click" data-cs-prop-post="launch-notes">See the course</a>
```

See [declarative events](https://docs.crispstats.com/track/declarative-events.md). CrispStats does not report on newsletter subscribers or email opens; Ghost stays the place for those.

## FAQ

> [accordion] Does it count members and anonymous readers?
>
> It counts every visit the same way, with an anonymous daily visitor id. It does not know who is a member unless you call `crispstats.identify()` yourself. See [identify signed-in users](https://docs.crispstats.com/track/identify-users.md).

> [accordion] Does a theme change remove the script?
>
> No. Code injection is a site setting, separate from your theme.

> [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] [AI traffic](https://docs.crispstats.com/ai/ai-traffic.md)
>
> See readers who arrive from ChatGPT, Perplexity and other assistants.

> [card] [Outbound links](https://docs.crispstats.com/track/outbound-links-and-downloads.md)
>
> See which links in your posts get clicked.

> [card] [Public dashboard](https://docs.crispstats.com/share/public-dashboard.md)
>
> Share your readership numbers with a link.

> [!NOTE]
>
> Ghost details (**Settings**, **Advanced**, **Code injection**, and **Site header** output inside `<head>`) are from Ghost's help and tutorial pages, [https://ghost.org/help/code-injection-styles/](https://ghost.org/help/code-injection-styles/) and [https://ghost.org/tutorials/use-code-injection-in-ghost/](https://ghost.org/tutorials/use-code-injection-in-ghost/), read on 2026-11-23.


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