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
API endpoint URL for sending events
Environment name (e.g., 'production', 'staging')
Release version for source map matching. Auto-detected if not specified.
Maximum events to queue before dropping oldest
Interval in milliseconds to flush queued events
Release Auto-Detection
How release detection works
If release is not specified, the SDK attempts to detect it from:
__PROLIFERATE_RELEASE__ global variable (injected by build plugins)
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 ,
},
});
Enable/disable replay recording
Maximum minutes of replay to buffer
Maximum number of events to buffer
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
CSS class for elements to mask text content
Mask all input values by default
Record canvas elements (expensive)
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 ,
},
});
Enable structured logging (must opt-in)
Minimum level to capture: 'trace', 'debug', 'info', 'warn', 'error', 'fatal'
Maximum logs to buffer before flush
Flush interval in milliseconds
Capture console.* calls as logs
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 } ` ;
Breadcrumb Options
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 ,
},
});
Option Type Default Description 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' ;