---
title: "Rybbit Analytics Setup for Nuxt · Nuxt Scripts"
description: "Add the Rybbit Analytics tracking script to a Nuxt app. Use hosted Rybbit or your own instance, and call the Rybbit tracking API from a typed composable."
canonical_url: "https://scripts.nuxt.com/scripts/rybbit-analytics"
meta:
  "og:description": "Add the Rybbit Analytics tracking script to a Nuxt app. Use hosted Rybbit or your own instance, and call the Rybbit tracking API from a typed composable."
  "og:image": "https://scripts.nuxt.com/_og/s/o_b8dc85ef86383353.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Rybbit Analytics Setup for Nuxt · Nuxt Scripts"
  "twitter:image": "https://scripts.nuxt.com/_og/s/o_b8dc85ef86383353.png"
---

> Index of every page on this site: [llms.txt](https://scripts.nuxt.com/llms.txt)

**Scripts**

# **Rybbit Analytics**

[Copy for LLMs](https://scripts.nuxt.com/scripts/rybbit-analytics.md)

**Get started with Rybbit Analytics**

[Sign Up](https://rybbit.com?via=nuxt-scripts)

[**Rybbit Analytics**](https://rybbit.com/) is an open-source web analytics platform. Its [**tracking script documentation**](https://rybbit.com/docs/script) covers the hosted and self-hosted script URLs.

**Rybbit Analytics**

[**View source **](https://github.com/nuxt/scripts/blob/main/packages/script/src/runtime/registry/rybbit-analytics.ts)

## 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 **](https://scripts.nuxt.com/docs/guides/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. **](https://scripts.nuxt.com/docs/guides/first-party)

**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 .

ConversionButton.vue

```
<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:

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

`**siteId**``string | number`** required **

Your Rybbit site ID.

`**autoTrackPageview**``boolean` = true

Automatically track page views.

`**trackSpa**``boolean` = true

Enable SPA (single-page app) route tracking.

`**trackQuery**``boolean`

Include query parameters in tracked URLs.

`**trackOutbound**``boolean`

Track outbound link clicks.

`**trackErrors**``boolean`

Track JavaScript errors.

`**sessionReplay**``boolean`

Enable session replay recording.

`**webVitals**``boolean`

Enable Web Vitals tracking (LCP, FID, CLS, etc.).

`**skipPatterns**``string[]`

URL patterns to skip from tracking (glob syntax).

`**maskPatterns**``string[]`

URL patterns to mask in tracked data (glob syntax).

`**debounce**``number`

Debounce interval (in ms) for page view tracking.

`**apiKey**``string`

API key for authenticated tracking.

`**analyticsHost**``string`

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

[Edit this page](https://github.com/nuxt/scripts/edit/main/docs/content/rybbit-analytics.md)

[Markdown For LLMs](https://scripts.nuxt.com/scripts/rybbit-analytics.md)

[**Reddit Pixel** Load Reddit Pixel and send page visits or conversion events through its typed API.](https://scripts.nuxt.com/scripts/reddit-pixel) [**Segment** Load Segment Analytics.js and queue page, event, identity, and group calls.](https://scripts.nuxt.com/scripts/segment)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://scripts.nuxt.com/#website","@type":"WebSite","description":"Nuxt Scripts lets you load third-party scripts with better performance, privacy, security and DX. It includes many popular third-parties out of the box.","name":"Nuxt Scripts","url":"https://scripts.nuxt.com/","publisher":{"@id":"https://scripts.nuxt.com/#identity"}},{"@id":"https://scripts.nuxt.com/scripts/rybbit-analytics#webpage","@type":"WebPage","description":"Add the Rybbit Analytics tracking script to a Nuxt app. Use hosted Rybbit or your own instance, and call the Rybbit tracking API from a typed composable.","name":"Rybbit Analytics Setup for Nuxt","url":"https://scripts.nuxt.com/scripts/rybbit-analytics","breadcrumb":{"@id":"https://scripts.nuxt.com/scripts/rybbit-analytics#breadcrumb"},"isPartOf":{"@id":"https://scripts.nuxt.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://scripts.nuxt.com/scripts/rybbit-analytics"]}],"primaryImageOfPage":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/#identity","@type":"Organization","name":"Nuxt Scripts","url":"https://scripts.nuxt.com","logo":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/scripts/rybbit-analytics#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Nuxt Scripts","item":"https://scripts.nuxt.com/","position":1},{"@type":"ListItem","name":"Scripts","item":"https://scripts.nuxt.com/scripts","position":2},{"@type":"ListItem","name":"Rybbit Analytics","item":"https://scripts.nuxt.com/scripts/rybbit-analytics","position":3}]},{"@id":"https://scripts.nuxt.com/#logo","@type":"ImageObject","caption":"Nuxt Scripts","contentUrl":"https://scripts.nuxt.com/logo.svg","inLanguage":"en","url":"https://scripts.nuxt.com/logo.svg"}]}
```

## Sitemap

See the full [sitemap](https://scripts.nuxt.com/sitemap.md) for all pages.
