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

# Add CrispStats to a Jekyll site

> Install CrispStats on a Jekyll site by adding the script tag to the head include or default layout, overriding the theme's file in your own _includes folder.

To add CrispStats to a Jekyll site, paste the script tag inside `<head>` in the include or layout every page uses, usually `_includes/head.html` or `_layouts/default.html`. Rebuild and deploy, and every page is tracked. Jekyll pages are plain HTML files, so each page load is one pageview.

You need your site's public key, which starts with `cs_pk_`. Find it in your site's settings under **Tracking code**, on the **HTML** tab. The key is safe to publish.

## Add the script

**1. Find the file that renders head**

If your layouts live in your project, open the one that contains `<head>`, often `_layouts/default.html` or `_includes/head.html`.

If they come from a gem-based theme such as Minima, the files are inside the gem. To change one, create a file with the same name in your site's own `_includes` or `_layouts` folder: Jekyll uses your file instead of the theme's. Copy the theme's `head.html` into `_includes/head.html` first so you keep what it already does. `bundle info --path minima` prints where the gem's files are.

**2. Paste the tag inside head**

```html _includes/head.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 and the domain with yours. Keep `defer` and do not add `type="module"`: the script reads its options from its own tag.

**3. Build and deploy**

Run `bundle exec jekyll build`, or push to the branch your host builds from. `jekyll serve` runs on `localhost`, which the script ignores, so a local preview does not count. Open your live site in a normal browser window.

## Turn on more tracking (optional)

Add attributes to the same tag. In HTML, a flag attribute is bare:

```html _includes/head.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>
```

[Script attributes](https://docs.crispstats.com/tracking/script-attributes.md) lists every attribute, including `data-exclude` for paths you do not want tracked.

## Check that it works

* In your browser's developer tools, the **Network** tab shows `d.js` loading from `in.crispstats.com` and a `POST` to `https://in.crispstats.com/e` that gets `202`.
* In CrispStats, **Settings**, **Tracking code** shows **Receiving events.**, and the visit appears in **Realtime** within seconds.
* Search a built page in `_site/` for `in.crispstats.com/d.js`. If it is missing, Jekyll is still using the theme's file: check that your copy has exactly the same name and folder.

To see events on `jekyll serve`, add `data-debug` and `localhost` in `data-domains` while you develop. See [localhost and testing](https://docs.crispstats.com/tracking/localhost-and-testing.md#debug-mode).

## How page changes are counted

Each Jekyll page is a full page load, so the script counts one pageview per page. Anchor links within a page are not new pages. Query strings are cut before sending, except UTM parameters and a few other campaign parameters, so `?utm_source=newsletter` still sets the source. See [script attributes](https://docs.crispstats.com/tracking/script-attributes.md).

## Send custom events

For clicks, add `data-cs-event` to the element in your template:

```html theme={"theme":{"light":"github-light","dark":"github-dark"}}
<a href="/download/guide.pdf" data-cs-event="guide download" data-cs-prop-format="pdf">Get the guide</a>
```

From your own JavaScript, call `window.crispstats?.("newsletter signup")`. See [custom events](https://docs.crispstats.com/track/custom-events.md).

## FAQ

> [accordion] Does it work on GitHub Pages?
>
> Yes. The tag is part of the HTML Jekyll builds, so it works on any static host. A [forwarding proxy](https://docs.crispstats.com/tracking/proxy.md) needs a host that can run a server rule. On a host that only serves static files, load the script from `in.crispstats.com` as shown here.

> [accordion] Do I need a Jekyll plugin?
>
> No. One tag in your head include is the whole install.

> [accordion] Will a theme update remove the tag?
>
> Not when the tag is in your own `_includes` or `_layouts` copy. Your file overrides the theme's file of the same name.

## Next steps

> [card] [Declarative events](https://docs.crispstats.com/track/declarative-events.md)
>
> Track clicks with attributes in your templates.

> [card] [Exclude traffic](https://docs.crispstats.com/tracking/exclude-traffic.md)
>
> Keep your own visits out of the numbers.

> [card] [Ad blockers](https://docs.crispstats.com/help/ad-blockers.md)
>
> What blockers hide and how a proxy helps.

> [!NOTE]
>
> Jekyll details (overriding a theme file with a file of the same name in your site's `_includes` or `_layouts` folder) checked against [https://jekyllrb.com/docs/themes/](https://jekyllrb.com/docs/themes/) on 2026-11-23.


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