Scripts

Databuddy Analytics

Databuddy is a privacy-first analytics platform focused on performance and minimal data collection.

Databuddy Analytics

View source

Nuxt Config Setup

Add this to your nuxt.config.ts to load Databuddy Analytics globally. Alternatively you can use the useScriptDatabuddyAnalytics composable for more control.

export default defineNuxtConfig({
  scripts: {
    registry: {
      databuddyAnalytics: {
        clientId: 'client-abc123',
        trigger: 'onNuxtReady',
      }
    }
  }
})

This config automatically enables first-party mode (bundle + proxy). See below to customise.

useScriptDatabuddyAnalytics()

The useScriptDatabuddyAnalytics composable lets you have fine-grain control over when and how Databuddy Analytics is loaded on your site.

const { proxy } = useScriptDatabuddyAnalytics()

proxy.track('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 Databuddy 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: {
      databuddyAnalytics: {
        clientId: 'client-abc123',
        trigger: 'onNuxtReady',
      },
    },
  },
})

Example

Using Databuddy Analytics in a component with the proxy to send events .

<script setup lang="ts">
const { proxy } = useScriptDatabuddyAnalytics()

// noop in development, ssr
// just works in production, client
function handleAction() {
  proxy.track('conversion', { value: 1 })
}
</script>

<template>
  <div>
    <button @click="handleAction">
      Send Event
    </button>
  </div>
</template>

CDN / Self-hosted

By default the registry injects https://cdn.databuddy.cc/databuddy.js. If you host the script yourself, pass scriptUrl in options to override the src.

useScriptDatabuddyAnalytics({
  scriptUrl: 'https://my-host/databuddy.js',
  clientId: 'YOUR_CLIENT_ID'
})
clientIdstring required

Your Databuddy client ID.

scriptUrlstring = 'https://cdn.databuddy.cc/databuddy.js'

Custom script URL for the Databuddy SDK.

apiUrlstring = 'https://basket.databuddy.cc'

Custom API URL for sending analytics data.

disabledboolean

Disable all tracking when set to `true`.

trackScreenViewsboolean = true

Track screen/page views automatically.

trackPerformanceboolean = true

Track page performance metrics.

trackSessionsboolean = true

Track user sessions.

trackWebVitalsboolean

Track Web Vitals (LCP, FID, CLS, etc.).

trackErrorsboolean

Track JavaScript errors.

trackOutgoingLinksboolean

Track outgoing link clicks.

trackScrollDepthboolean

Track scroll depth.

trackEngagementboolean

Track user engagement time.

trackInteractionsboolean

Track user interactions (clicks, form submissions, etc.).

trackAttributesboolean

Track element attributes for detailed interaction context.

trackHashChangesboolean

Track hash changes in the URL.

trackExitIntentboolean

Track exit intent behavior.

trackBounceRateboolean

Track bounce rate metrics.

enableBatchingboolean

Enable event batching for better performance.

batchSizenumber

Maximum number of events per batch.

batchTimeoutnumber

Timeout (in ms) before flushing a batch.

enableRetriesboolean

Enable automatic retries for failed requests.

maxRetriesnumber

Maximum number of retry attempts.

initialRetryDelaynumber

Initial delay (in ms) before the first retry.

samplingRatenumber

Sampling rate (0 to 1). Set to `0.5` to track ~50% of sessions.

sdkstring

Custom SDK identifier.

sdkVersionstring

Custom SDK version string.

enableObservabilityboolean

Enable observability/monitoring features.

observabilityServicestring

The service name for observability reporting.

observabilityEnvironmentstring

The environment name for observability (e.g., `'production'`, `'staging'`).

observabilityVersionstring

The version string for observability reporting.

enableLoggingboolean

Enable console logging for debugging.

enableTracingboolean

Enable request tracing.

enableErrorTrackingboolean

Enable error tracking via observability.