Меню документации

Configuration

Documentation is available in English. Перевод в процессе.

Full configuration reference for BugSpotter.init().

BugSpotterConfig

interface BugSpotterConfig {
  apiKey: string;       // Required: API key (bgs_...)
  endpoint?: string;    // BugSpotter API URL
  sampleRate?: number;  // Session sampling (0-1, default: 1)
  showWidget?: boolean; // Show floating button (default: true)

  replay?: {
    enabled?: boolean;              // Enable replay (default: true)
    duration?: number;              // Buffer seconds (default: 15)
    sampling?: {
      mousemove?: number;           // Throttle ms (default: 50)
      scroll?: number;              // Throttle ms (default: 100)
    };
    blockSelectors?: string[];      // CSS selectors to exclude from replay
    blockClass?: string;            // CSS class to exclude from replay
    inlineStylesheet?: boolean;     // Inline CSS (default: backend)
    inlineImages?: boolean;         // Inline images (default: backend)
    collectFonts?: boolean;         // Collect fonts (default: backend)
    recordCanvas?: boolean;         // Record canvas (default: backend)
    recordCrossOriginIframes?: boolean;
  };

  sanitize?: {
    enabled?: boolean;              // Enable PII sanitization (default: true)
    patterns?: PresetName | PatternName[];
    customPatterns?: CustomPattern[];
    excludeSelectors?: string[];    // Exclude DOM elements from text sanitization
  };
}

sampleRate

Controls what fraction of sessions activate capture. Unsampled sessions initialize with zero overhead — no console/network interception, no DOM recording, no widget.

sampleRate: 1     // Capture all sessions (default)
sampleRate: 0.1   // Capture 10% of sessions
sampleRate: 0     // Capture nothing (SDK inactive)

Use bugspotter.isSampled to check at runtime whether the current session is being captured.

blockSelectors

Exclude sensitive DOM elements from session replay recording. Matched elements are replaced with a placeholder block in the replay.

replay: {
  blockSelectors: [
    '.portfolio-table',
    '#balance-widget',
    '[data-sensitive]',
  ],
  blockClass: 'bugspotter-block',  // Alternative: class-based
}

For screenshots, use the data-bugspotter-exclude attribute on HTML elements instead.

Replay Quality

Replay quality settings can be controlled from the backend (admin panel) or overridden in the SDK config. User config always takes precedence.

OptionDefaultDescription
duration15sRolling buffer length (max 30s recommended)
sampling.mousemove50msThrottle mousemove events
sampling.scroll100msThrottle scroll events
inlineStylesheetbackendInline CSS for replay fidelity
inlineImagesbackendInline images (increases size)
recordCanvasbackendRecord canvas elements

Next: PII Redaction →