Install Foresite on VitePress
VitePress adds the tags in its head option to every page. In .vitepress/config.mts (or .js):
import { defineConfig } from 'vitepress'
export default defineConfig({
head: [['script', { defer: '', src: 'https://t.foresite.dev/s/YOUR_SITE_ID.js' }]],
})
Use the address from your own Foresite line (Settings → Install), then build and deploy. The empty string after defer is how VitePress writes an attribute with no value.
VitePress switches pages without reloading; Foresite counts each page change as a pageview automatically. Visits to localhost aren't counted, so test on your published docs: the Installation Check in Settings → Install turns green with the first pageview.