Scripts

Rybbit Analytics

Get started with Rybbit Analytics

Sign Up

Rybbit Analytics is a privacy-focused analytics solution for tracking user activity on your website without compromising your users' privacy.

Rybbit Analytics

View source

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.

Mode
Bundle Proxy
Privacy
User IP addresses are anonymised. Other request data passes through.
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 = true

Automatically track page views.

trackSpaboolean = true

Enable SPA (single-page app) route tracking.

trackQueryboolean

Include query parameters in tracked URLs.

trackOutboundboolean

Track outbound link clicks.

trackErrorsboolean

Track JavaScript errors.

sessionReplayboolean

Enable session replay recording.

webVitalsboolean

Enable 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).

debouncenumber

Debounce interval (in ms) for page view tracking.

apiKeystring

API key for authenticated tracking.

analyticsHoststring

Override 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`.