---
title: Databuddy
description: Databuddy is a privacy-focused analytics platform that helps you
  understand user behavior and track events. It supports cookieless tracking and
  manages consent automatically through c15t's consent state synchronization.
icon: databuddy
group: integrations
---
The Databuddy script automatically respects consent preferences by toggling tracking on and off based on the user's consent state.

## Integrate with c15t

**React**

```tsx
import { type ReactNode } from 'react';
import { ConsentManagerProvider } from '@c15t/react';
import { databuddy } from '@c15t/scripts/databuddy';

const scripts = [
  databuddy({
    clientId: 'your-client-id',
    scriptUrl: 'https://cdn.databuddy.cc/databuddy.js',
    apiUrl: 'https://basket.databuddy.cc',
    configWhenGranted: {
      clientId: 'your-client-id',
      apiUrl: 'https://basket.databuddy.cc',
      disabled: false,
    },
    configWhenDenied: {
      clientId: 'your-client-id',
      apiUrl: 'https://basket.databuddy.cc',
      disabled: true,
    },
  }),
];

export function ConsentProvider({ children }: { children: ReactNode }) {
  return (
    <ConsentManagerProvider
      options={{
        mode: 'hosted',
        backendURL: 'https://your-instance.c15t.dev',
        scripts,
      }}
    >
      {children}
    </ConsentManagerProvider>
  );
}
```

**Next.js**

```tsx
'use client';

import { type ReactNode } from 'react';
import { ConsentManagerProvider } from '@c15t/nextjs';
import { databuddy } from '@c15t/scripts/databuddy';

const scripts = [
  databuddy({
    clientId: 'your-client-id',
    scriptUrl: 'https://cdn.databuddy.cc/databuddy.js',
    apiUrl: 'https://basket.databuddy.cc',
    configWhenGranted: {
      clientId: 'your-client-id',
      apiUrl: 'https://basket.databuddy.cc',
      disabled: false,
    },
    configWhenDenied: {
      clientId: 'your-client-id',
      apiUrl: 'https://basket.databuddy.cc',
      disabled: true,
    },
  }),
];

export function ConsentProvider({ children }: { children: ReactNode }) {
  return (
    <ConsentManagerProvider
      options={{
        mode: 'hosted',
        backendURL: '/api/c15t',
        scripts,
      }}
    >
      {children}
    </ConsentManagerProvider>
  );
}
```

**JavaScript**

```ts
import { getOrCreateConsentRuntime } from 'c15t';
import { databuddy } from '@c15t/scripts/databuddy';

getOrCreateConsentRuntime({
  mode: 'hosted',
  backendURL: 'https://your-instance.c15t.dev',
  scripts: [
    databuddy({
      clientId: 'your-client-id',
      scriptUrl: 'https://cdn.databuddy.cc/databuddy.js',
      apiUrl: 'https://basket.databuddy.cc',
      configWhenGranted: {
        clientId: 'your-client-id',
        apiUrl: 'https://basket.databuddy.cc',
        disabled: false,
      },
      configWhenDenied: {
        clientId: 'your-client-id',
        apiUrl: 'https://basket.databuddy.cc',
        disabled: true,
      },
    }),
  ],
});
```

## How c15t loads it

* **Category:** `measurement` (Analytics)
* **Loads when:** [`alwaysLoad`](/docs/frameworks/react/script-loader#always-load) — runs on page start regardless of consent state
* **On consent change:** c15t toggles `window.databuddy.options.disabled` so tracking turns on or off without removing the script

## Configure the integration

The Databuddy manifest expects explicit initial config objects for the granted
and denied consent states:

```ts
databuddy({
  clientId: 'your-client-id',
  scriptUrl: 'https://cdn.databuddy.cc/databuddy.js',
  apiUrl: 'https://basket.databuddy.cc', // Optional, defaults to basket.databuddy.cc, change if self-hosting
  configWhenGranted: {
    clientId: 'your-client-id',
    apiUrl: 'https://basket.databuddy.cc',
    // Tracking options
    trackScreenViews: true,        // Automatically track page views
    trackOutgoingLinks: true,      // Track clicks on external links
    trackAttributes: false,        // Track data-track attributes on elements
    trackErrors: false,            // Track JavaScript errors
    trackPerformance: true,        // Track performance metrics
    trackWebVitals: false,         // Track Core Web Vitals


    // Network options
    enableBatching: false,         // Batch events before sending
    batchSize: 10,                 // Events per batch
    batchTimeout: 2000,            // Batch timeout in ms
    samplingRate: 1.0,             // Sample rate (0.0-1.0)
    disabled: false,
  },
  configWhenDenied: {
    clientId: 'your-client-id',
    apiUrl: 'https://basket.databuddy.cc',
    disabled: true,
  }
})
```

## Tracking events in your app

Databuddy is `alwaysLoad: true`, so the script is in the DOM from page start regardless of consent. `window.databuddy` is therefore always defined and calls to `track`, `screenView`, or `setGlobalProperties` are safe to make at any time — when measurement consent is denied, c15t flips `window.databuddy.options.disabled = true` so the SDK becomes a no-op until consent is granted again.

```ts
window.databuddy?.track('signup');
```

You do not need to guard these calls with `useConsentManager().has('measurement')`, but doing so does no harm if you prefer the symmetry with other vendors.

## Consent and privacy

The Databuddy integration automatically handles consent management:

1. **Before Script Load**: Sets `window.databuddyConfig.disabled` based on initial consent state
2. **On Consent Grant**: Enables tracking by setting `window.databuddy.options.disabled = false`
3. **On Consent Revoke**: Disables tracking by setting `window.databuddy.options.disabled = true`

This ensures that no tracking occurs without user consent, keeping your analytics privacy-compliant.

## Types

### DatabuddyConsentOptions

|Property|Value|
|:--|:--|
|Type Name|\`DatabuddyConsentOptions\`|
|Source Path|\`./packages/scripts/src/vendors/analytics/databuddy.ts\`|

\*ExtractedTypeTable: Could not extract "DatabuddyConsentOptions" from "./packages/scripts/src/vendors/analytics/databuddy.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*

### Script

|Property|Value|
|:--|:--|
|Type Name|\`Script\`|
|Source Path|\`./packages/core/src/libs/script-loader/types.ts\`|

\*ExtractedTypeTable: Could not extract "Script" from "./packages/core/src/libs/script-loader/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
