Rybbit Analytics
Get started with Rybbit Analytics
Rybbit Analytics is an open-source web analytics platform. Its tracking script documentation covers the hosted and self-hosted script URLs.
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
Rybbit's official self-hosted snippet replaces app.rybbit.io in /api/script.js. The current composable appends /script.js to analyticsHost, so include /api in the value:
useScriptRybbitAnalytics({
analyticsHost: 'https://your-rybbit-instance.com/api',
siteId: 'YOUR_SITE_ID'
})
Passing only the origin currently requests https://your-rybbit-instance.com/script.js, which differs from Rybbit's documented path.
Rybbit now configures automatic page views, SPA navigation, outbound links, errors, session replay, and Web Vitals in the site dashboard. The current wrapper still emits older data-* attributes for those fields, which the current tracker documentation does not list. It also omits data-debounce when debounce is 0, even though Rybbit documents zero as the way to disable debouncing.
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`.