Skip to main content
The Databuddy SDK provides a complete solution for tracking user behavior and custom events across all your platforms. Built with privacy and performance in mind.

Features

Privacy-First

No cookies, respects DNT, compliant with GDPR/CCPA out of the box

Lightweight

< 5KB gzipped browser bundle with zero dependencies

Framework Support

First-class support for React, Vue, Next.js, and vanilla JS

Server-Side

Node.js SDK for backend tracking and API events

Auto-Tracking

Automatic page views, web vitals, errors, and scroll depth

Type-Safe

Full TypeScript support with intelligent autocomplete

Quick Start

npm install @databuddy/sdk

Platform Guides

JavaScript

Vanilla JavaScript for any web project

React

React hooks and components for Next.js and React apps

Vue

Vue composables and plugins for Vue 3 apps

Node.js

Server-side tracking for APIs and backend services

Package Structure

The SDK is published as a single package with multiple entry points:
  • @databuddy/sdk - Core browser SDK
  • @databuddy/sdk/react - React integration
  • @databuddy/sdk/vue - Vue integration
  • @databuddy/sdk/node - Node.js server-side SDK

Core Concepts

Events

Track custom events with properties:
import { track } from '@databuddy/sdk';

track('button_clicked', {
  buttonText: 'Get Started',
  location: 'hero',
  plan: 'pro'
});

Automatic Tracking

Enable automatic tracking of common metrics:
<Databuddy
  trackWebVitals      // Core Web Vitals (LCP, FID, CLS)
  trackErrors         // JavaScript errors
  trackScrollDepth    // Scroll engagement
  trackOutgoingLinks  // External link clicks
/>

Session Management

Each user gets:
  • Anonymous ID - Persists across sessions (localStorage)
  • Session ID - Expires after 30 min of inactivity (sessionStorage)
import { getAnonymousId, getSessionId } from '@databuddy/sdk';

const anonId = getAnonymousId();
const sessionId = getSessionId();

Privacy Controls

<Databuddy
  disabled={!userConsent}           // Disable tracking entirely
  samplingRate={0.5}                 // Track 50% of sessions
  skipPatterns={['/admin/**']}       // Ignore admin pages
  maskPatterns={['/users/*']}        // Mask sensitive URLs
/>

TypeScript Support

The SDK is written in TypeScript with full type definitions:
import type { 
  DatabuddyConfig, 
  EventProperties,
  DatabuddyTracker 
} from '@databuddy/sdk';

// Type-safe event tracking
const properties: EventProperties = {
  plan: 'pro',
  price: 29.99,
  currency: 'USD'
};

track('subscription_created', properties);

Browser Support

  • Chrome/Edge 90+
  • Firefox 88+
  • Safari 14+
  • iOS Safari 14+
  • Samsung Internet 15+
The SDK uses modern browser APIs but gracefully degrades on older browsers.

Next Steps

Installation

Detailed installation guide for all platforms

Configuration

Complete configuration options reference

React Guide

Learn about React hooks and components

Node.js Guide

Server-side tracking for backend applications