# Add Privatus Analytics to VitePress

> Add cookieless analytics to a VitePress docs site with the head option in .vitepress/config, with page changes counted as page views automatically.

Add the script to `head` in `.vitepress/config.mts`:

```ts
import { defineConfig } from 'vitepress'

export default defineConfig({
  // ...
  head: [
    [
      'script',
      {
        defer: '',
        src: 'https://privatusstats.com/js/pa.js',
        'data-site': 'pa_YOURSITEID',
        'data-modules': 'engage,auto,vitals,clicks,ask',
      },
    ],
  ],
})
```

VitePress renders `head` entries into the static HTML of every page, and a
page can add more through its frontmatter `head`. Each entry is an array of
the tag name and an object of attributes.

VitePress is a single-page app after the first load. The tracker follows its
`history.pushState` navigations automatically. See
[single-page apps](/docs/tracker/spa).

The tracker ignores `localhost`, so `vitepress dev` is not counted. Preview
or staging hostnames are dropped unless you add them as an
[additional domain](/docs/getting-started/add-a-site#more-settings-under-site-settings-general).
