nuxt-foresite
| Install | |
|---|---|
npm install nuxt-foresite |
|
| Latest Version: | 1.0.0 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Oct 9, 2026 |
| Links: | GitHub · npm |
nuxt-foresite
Foresite for Nuxt: privacy-first website analytics with no cookies and nothing that identifies your visitors.
This module adds the Foresite Tracking Script to every page's <head>, server-rendered, static or single-page, and gives you useForesite() for custom events. Client-side page changes are counted as pageviews automatically.
Setup
npm install nuxt-foresite
// nuxt.config.ts
export default defineNuxtConfig({
modules: ['nuxt-foresite'],
foresite: {
siteId: 's_k3v9q2m7xw4a', // from Settings → Install in Foresite
},
})
Don't have a Site ID yet? Start a free 7-day trial, no card required, or open the live demo.
Options
| Option | Default | |
|---|---|---|
siteId |
Your Site ID, from Settings → Install. Without one, the module does nothing. | |
host |
t.foresite.dev |
Where the script is served from. Set it to your custom domain (like stats.example.com) so ad blockers don't hide your visitors. |
enabled |
true |
false leaves the script out, for example on a staging deploy. |
Each option can also be set when a server-rendered app starts, through NUXT_PUBLIC_FORESITE_SITE_ID, NUXT_PUBLIC_FORESITE_HOST and NUXT_PUBLIC_FORESITE_ENABLED.
Visits to localhost are never counted, so nuxt dev won't add test traffic.
Custom events
<script setup lang="ts">
const foresite = useForesite()
function onSignup() {
foresite('signup', { props: { plan: 'pro' } })
}
function onPurchase() {
foresite('purchase', { revenue: { amount: 49.99, currency: 'USD' } })
}
</script>
Events sent before the script has loaded are queued, and calls during server rendering do nothing. Never put personal data in properties. See custom events, goals and revenue.
License
MIT. The Tracking Script itself is open source too.
Related Packages
Nuxt module for measuremy.site: cookieless web analytics your AI agent can read.
Nuxt module for self-hosted Umami under the CNIL audience-measurement exemption:...
MIRA FIVE for Nuxt: one module for privacy-first analytics, feature flags with a...
Add Pulse Analytics — privacy-first web analytics — to a Nuxt site with one modu...
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.0.0 | ^3.0 | MIT |
Pre-releases (1)
| Version | Released | License |
|---|---|---|
| 0.0.0-stage |