Scripts

Rybbit Analytics

Last updated by Harlan Wilton in chore: lint.

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.

Script Stats
Transfer
9.0 KB
Decoded
25.3 KB
Loading
CDN
First-Party
Supported
Bundling
No
Privacy
No data collected
Tracked Data
Page Views Events

View source

Nuxt Config Setup

The simplest way to load Rybbit Analytics globally in your Nuxt App is to use Nuxt config. Alternatively you can directly use the useScriptRybbitAnalytics composable.

export default defineNuxtConfig({
  scripts: {
    registry: {
      rybbitAnalytics: {
        siteId: '10001'
      }
    }
  }
})

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

This script supports First-Party Mode which routes all traffic through your domain for improved privacy and ad blocker bypass.

export default defineNuxtConfig({
  scripts: {
    firstParty: true,
    registry: {
      rybbitAnalytics: { siteId: '10001'}
    }
  }
})

Example

Using Rybbit Analytics only in production while using 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({
  scriptInput: {
    src: 'https://your-rybbit-instance.com/api/script.js'
  },
  siteId: 'YOUR_SITE_ID'
})

Configuration Options

  • siteId (required): Your Rybbit Analytics site ID autoTrackPageview: Set to false to disable automatic tracking of the initial pageview when the script loads. You will need to manually call the pageview function to track pageviews. Default: true
  • trackSpa: Set to false to disable automatic pageview tracking for single page applications
  • trackQuery: Set to false to disable tracking of URL query strings
  • trackOutbound: Set to false to disable automatic tracking of outbound link clicks. Default: true
  • trackErrors: Set to true to enable automatic tracking of JavaScript errors and unhandled promise rejections. Only tracks errors from the same origin to avoid noise from third-party scripts. Default: false
  • sessionReplay: Set to true to enable session replay recording. Captures user interactions, mouse movements, and DOM changes for debugging and user experience analysis. Default: false
  • webVitals: Set to true to enable Web Vitals performance metrics collection (LCP, CLS, INP, FCP, TTFB). Nuxt disables Web Vitals by default to reduce script size and network requests. Default: false
  • skipPatterns: Array of URL path patterns to ignore
  • maskPatterns: Array of URL path patterns to mask for privacy
  • debounce: Delay in milliseconds before tracking a pageview after URL changes
  • apiKey: API key for tracking from localhost during development. Bypasses origin validation for self-hosted Rybbit Analytics instances