Databuddy Analytics
Databuddy is a privacy-first analytics platform focused on performance and minimal data collection.
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.
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.
disabledbooleanDisable all tracking when set to `true`.
trackScreenViewsboolean = trueTrack screen/page views automatically.
trackPerformanceboolean = trueTrack page performance metrics.
trackSessionsboolean = trueTrack user sessions.
trackWebVitalsbooleanTrack Web Vitals (LCP, FID, CLS, etc.).
trackErrorsbooleanTrack JavaScript errors.
trackOutgoingLinksbooleanTrack outgoing link clicks.
trackScrollDepthbooleanTrack scroll depth.
trackEngagementbooleanTrack user engagement time.
trackInteractionsbooleanTrack user interactions (clicks, form submissions, etc.).
trackAttributesbooleanTrack element attributes for detailed interaction context.
trackHashChangesbooleanTrack hash changes in the URL.
trackExitIntentbooleanTrack exit intent behavior.
trackBounceRatebooleanTrack bounce rate metrics.
enableBatchingbooleanEnable event batching for better performance.
batchSizenumberMaximum number of events per batch.
batchTimeoutnumberTimeout (in ms) before flushing a batch.
enableRetriesbooleanEnable automatic retries for failed requests.
maxRetriesnumberMaximum number of retry attempts.
initialRetryDelaynumberInitial delay (in ms) before the first retry.
samplingRatenumberSampling rate (0 to 1). Set to `0.5` to track ~50% of sessions.
sdkstringCustom SDK identifier.
sdkVersionstringCustom SDK version string.
enableObservabilitybooleanEnable observability/monitoring features.
observabilityServicestringThe service name for observability reporting.
observabilityEnvironmentstringThe environment name for observability (e.g., `'production'`, `'staging'`).
observabilityVersionstringThe version string for observability reporting.
enableLoggingbooleanEnable console logging for debugging.
enableTracingbooleanEnable request tracing.
enableErrorTrackingbooleanEnable error tracking via observability.