Rybbit Analytics
Get started with Rybbit Analytics
Rybbit Analytics is a privacy-focused analytics solution for tracking user activity on your website without compromising your users' privacy.
Nuxt Config Setup
Add this to your nuxt.config.ts to load Rybbit Analytics globally. Alternatively you can use the useScriptRybbitAnalytics composable for more control.
export default defineNuxtConfig({
scripts: {
registry: {
rybbitAnalytics: {
siteId: '10001',
trigger: 'onNuxtReady',
}
}
}
})This config automatically enables first-party mode (bundle + proxy). See below to customise.
useScriptRybbitAnalytics()
The useScriptRybbitAnalytics composable lets you have fine-grain control over when and how Rybbit Analytics is loaded on your site.
const { proxy } = useScriptRybbitAnalytics()
proxy.event('conversion', { value: 1 })Please follow the Registry Scripts guide to learn more about advanced usage.
First-Party Mode: Privacy Focused Proxy
No extra config needed. The script is bundled from your domain (faster loads, no extra DNS lookup) and runtime requests are reverse-proxied through your server with automatic anonymisation (user IPs stay hidden from Rybbit Analytics, works with ad blockers). Learn more.
export default defineNuxtConfig({
scripts: {
// ✅ First-party mode: bundled + proxied
registry: {
rybbitAnalytics: {
siteId: '10001',
trigger: 'onNuxtReady',
},
},
},
})Example
Using Rybbit Analytics in a component with the proxy to send events .
<script setup lang="ts">
const { proxy } = useScriptRybbitAnalytics()
// noop in development, ssr
// just works in production, client
function handleAction() {
proxy.event('conversion', { value: 1 })
}
</script>
<template>
<div>
<button @click="handleAction">
Send Event
</button>
</div>
</template>Self-hosted Rybbit Analytics
If you are using a self-hosted version of Rybbit Analytics, you can provide a custom script source:
useScriptRybbitAnalytics({
analyticsHost: 'https://your-rybbit-instance.com',
siteId: 'YOUR_SITE_ID'
})
siteIdstring | number required Your Rybbit site ID.
autoTrackPageviewboolean = trueAutomatically track page views.
trackSpaboolean = trueEnable SPA (single-page app) route tracking.
trackQuerybooleanInclude query parameters in tracked URLs.
trackOutboundbooleanTrack outbound link clicks.
trackErrorsbooleanTrack JavaScript errors.
sessionReplaybooleanEnable session replay recording.
webVitalsbooleanEnable Web Vitals tracking (LCP, FID, CLS, etc.).
skipPatternsstring[]URL patterns to skip from tracking (glob syntax).
maskPatternsstring[]URL patterns to mask in tracked data (glob syntax).
debouncenumberDebounce interval (in ms) for page view tracking.
apiKeystringAPI key for authenticated tracking.
analyticsHoststringOverride the analytics host URL. When first-party mode is enabled, this is auto-injected to route through the proxy. The SDK derives its API endpoint from the script src, so this changes the script src to `${analyticsHost}/script.js`.