Skip to main content
Complete reference for the Proliferate JavaScript SDK init() options.

Basic Configuration

import Proliferate from '@proliferate/sdk';

Proliferate.init({
  endpoint: 'https://api.yourapp.com/api/v1/errors',
  apiKey: 'pk_your_api_key',
  environment: 'production',
  release: '1.2.3',
});

Core Options

endpoint
string
required
API endpoint URL for sending events
apiKey
string
required
Your project API key
environment
string
Environment name (e.g., 'production', 'staging')
release
string
Release version for source map matching. Auto-detected if not specified.
maxQueueSize
number
default:"100"
Maximum events to queue before dropping oldest
flushIntervalMs
number
default:"5000"
Interval in milliseconds to flush queued events

Release Auto-Detection

If release is not specified, the SDK attempts to detect it from:
  1. __PROLIFERATE_RELEASE__ global variable (injected by build plugins)
  2. Environment variables (in SSR/Node.js contexts):
    • PROLIFERATE_RELEASE
    • GITHUB_SHA
    • VERCEL_GIT_COMMIT_SHA
    • CF_PAGES_COMMIT_SHA
    • RENDER_GIT_COMMIT
    • RAILWAY_GIT_COMMIT_SHA
    • GITLAB_CI_COMMIT_SHA
    • CIRCLE_SHA1
    • COMMIT_SHA
    • GIT_COMMIT

Replay Options

Configure session replay recording under the replay key:
Proliferate.init({
  endpoint: 'https://api.yourapp.com/api/v1/errors',
  apiKey: 'pk_your_api_key',
  replay: {
    enabled: true,
    maxBufferMinutes: 5,
    maskAllInputs: true,
  },
});
replay.enabled
boolean
default:"true"
Enable/disable replay recording
replay.maxBufferMinutes
number
default:"5"
Maximum minutes of replay to buffer
replay.maxBufferEvents
number
default:"10000"
Maximum number of events to buffer
replay.maxBufferBytes
number
default:"5242880"
Maximum bytes to buffer (5MB)
replay.blockClass
string
default:"no-capture"
CSS class for elements to exclude from recording
replay.ignoreClass
string
default:"ignore-input"
CSS class for inputs to ignore
replay.maskTextClass
string
default:"mask"
CSS class for elements to mask text content
replay.maskAllInputs
boolean
default:"true"
Mask all input values by default
replay.recordCanvas
boolean
default:"false"
Record canvas elements (expensive)
replay.idleTimeoutMs
number
default:"300000"
Idle timeout before pausing recording (5 minutes)

Privacy Controls

Use CSS classes to control what gets recorded:
<!-- Exclude element entirely from replay -->
<div class="no-capture">Sensitive content here</div>

<!-- Ignore input value changes -->
<input type="text" class="ignore-input" />

<!-- Mask text content -->
<span class="mask">[email protected]</span>

Logging Options

Configure structured logging under the logs key:
Proliferate.init({
  endpoint: 'https://api.yourapp.com/api/v1/errors',
  apiKey: 'pk_your_api_key',
  logs: {
    enabled: true,
    minLevel: 'info',
    captureConsole: true,
  },
});
logs.enabled
boolean
default:"false"
Enable structured logging (must opt-in)
logs.minLevel
string
default:"info"
Minimum level to capture: 'trace', 'debug', 'info', 'warn', 'error', 'fatal'
logs.maxBufferSize
number
default:"50"
Maximum logs to buffer before flush
logs.flushIntervalMs
number
default:"5000"
Flush interval in milliseconds
logs.captureConsole
boolean
default:"false"
Capture console.* calls as logs
logs.consoleLevels
array
Console levels to capture if captureConsole is true: ['log', 'info', 'warn', 'error', 'debug']

Using the Logger

// After init with logs enabled
Proliferate.logger.info('User signed in', { userId: '123' });
Proliferate.logger.error('Payment failed', { orderId: '456', reason: 'card_declined' });

// Template logging for aggregation
Proliferate.logger.fmt`User ${userId} completed action ${action}`;
Configure automatic breadcrumb collection under the breadcrumbs key:
Proliferate.init({
  endpoint: 'https://api.yourapp.com/api/v1/errors',
  apiKey: 'pk_your_api_key',
  breadcrumbs: {
    fetch: true,
    xhr: true,
    console: true,
    click: true,
    navigation: true,
    maxBreadcrumbs: 100,
  },
});
OptionTypeDefaultDescription
fetchbooleantrueCapture fetch requests
xhrbooleantrueCapture XMLHttpRequest calls
consolebooleantrueCapture console logs/warnings/errors
clickbooleantrueCapture click events
navigationbooleantrueCapture URL changes
maxBreadcrumbsnumber100Maximum breadcrumbs to keep

Full Configuration Example

import Proliferate from '@proliferate/sdk';

Proliferate.init({
  // Required
  endpoint: 'https://api.yourapp.com/api/v1/errors',
  apiKey: 'pk_your_api_key',

  // Environment
  environment: process.env.NODE_ENV,
  release: process.env.NEXT_PUBLIC_PROLIFERATE_RELEASE,

  // Queue settings
  maxQueueSize: 100,
  flushIntervalMs: 5000,

  // Session replay
  replay: {
    enabled: true,
    maxBufferMinutes: 5,
    maxBufferEvents: 10000,
    maxBufferBytes: 5 * 1024 * 1024, // 5MB
    blockClass: 'no-capture',
    ignoreClass: 'ignore-input',
    maskTextClass: 'mask',
    maskAllInputs: true,
    recordCanvas: false,
  },

  // Structured logging
  logs: {
    enabled: true,
    minLevel: 'info',
    maxBufferSize: 50,
    flushIntervalMs: 5000,
    captureConsole: false,
  },

  // Breadcrumbs
  breadcrumbs: {
    fetch: true,
    xhr: true,
    console: true,
    click: true,
    navigation: true,
    maxBreadcrumbs: 100,
  },
});

Runtime Methods

User & Account Context

// Set user context (after login)
Proliferate.setUser({ id: 'user_123', email: '[email protected]' });

// Set account context (for B2B apps)
Proliferate.setAccount({ id: 'acct_456', name: 'Acme Corp' });

// Clear context (on logout)
Proliferate.setUser(null);
Proliferate.setAccount(null);

Manual Error Capture

// Capture an exception
const eventId = Proliferate.captureException(error, {
  extra: { orderId: '123' },
});

// Capture a message
const eventId = Proliferate.captureMessage('User completed onboarding', {
  level: 'info',
  extra: { step: 5 },
});

Custom Breadcrumbs

Proliferate.addBreadcrumb('custom', 'User clicked checkout button', 'info', {
  cartTotal: 99.99,
  itemCount: 3,
});

Replay Control

// Check if replay is recording
const isRecording = Proliferate.isReplayRecording();

// Get replay statistics
const stats = Proliferate.getReplayStats();
// { eventCount: 1234, sizeBytes: 256000, hasFullSnapshot: true }

// Manually start replay (if disabled at init)
await Proliferate.startReplay();

// Stop replay
Proliferate.stopReplay();

Session & Trace IDs

// Get current session ID (for correlation)
const sessionId = Proliferate.getSessionId();

// Get current window ID (for multi-tab scenarios)
const windowId = Proliferate.getWindowId();

// Get current trace ID (for log correlation)
const traceId = Proliferate.getTraceId();

Cleanup

// Destroy the SDK and clean up resources
Proliferate.destroy();

TypeScript Types

All configuration types are exported:
import type {
  InitOptions,
  ReplayInitOptions,
  LogsInitOptions,
  BreadcrumbsInitOptions,
  UserContext,
  AccountContext,
  CaptureOptions,
  MessageOptions,
  Breadcrumb,
  BreadcrumbCategory,
  BreadcrumbLevel,
} from '@proliferate/sdk';