SDK Configuration

Customize WhatzBug SDK behavior with initialization options and feature flags.

Basic Initialization

App.tsxtypescript
import WhatzBug from '@whatzbug/react-native';

await WhatzBug.init({
  projectId: 'your-project-id',
  publishableKey: 'pk_your_key',
  apiBaseUrl: 'https://api.whatzbug.com',
  debug: true, // auto-connect to Desktop App
});

The init() method is idempotent — calling it multiple times is safe and will be a no-op after the first successful init.

Configuration Options

OptionTypeDefaultDescription
projectIdstringRequiredProject ID from your dashboard
publishableKeystringRequiredPublishable API key
apiBaseUrlstringRequiredBackend API URL
debugboolean | objectfalseAuto-connect to WhatzBug Desktop for real-time debugging. Pass true or { host, port }
flushIntervalMsnumber5000Event batch flush interval (ms)
maxQueueSizenumber1000Max events before force-flush
enableNetworkMonitoringbooleantrueAuto-intercept XHR/fetch
featuresWhatzBugFeaturesAll enabledFeature opt-out flags

Feature Opt-Out

Disable specific SDK features by setting them to false:

await WhatzBug.init({
  projectId: 'your-project-id',
  publishableKey: 'pk_your_key',
  apiBaseUrl: 'https://api.whatzbug.com',
  features: {
    replay: true,       // Session Replay
    network: true,      // Network monitoring
    crashes: true,      // Crash reporting
    session: true,      // Session management
    journey: true,      // Journey recording
    performance: true,  // Performance monitoring
  },
});

Safety Guarantees

No-Throw Safety

All WhatzBug SDK methods are wrapped in no-throw safety wrappers (noThrow() / safeAsync()). The SDK will never crash your app.

Next Steps