Press ⌘K anywhere to search

TraceRN.init

Initialize the SDK

Call once as early as possible (e.g. index.js / root layout):

typescript
import { TraceRN } from "tracern-sdk";

TraceRN.init({
  apiKey: "trn_live_xxxxxxxx", // required — from Project → Settings
  environment: "production", // default "production"
  release: "1.2.0", // match source maps + release health
  enableAutoErrorCapture: true, // default true
  enableConsoleCapture: false, // default false
  enableAutoBreadcrumbs: true, // default true
  enableNetworkBreadcrumbs: true, // fetch breadcrumbs when auto on
  enableAppStateBreadcrumbs: true, // AppState breadcrumbs when auto on
  enableSessionHeartbeat: true, // session ping for crash-free %
  slowNetworkThresholdMs: undefined, // e.g. 3000 → warn on slow fetch
  maxBreadcrumbs: 50, // default 50, max 100
  sampleRate: 1, // info/warn only; errors always send
  userId: "user_42", // optional; or call setUser later
  tags: { platform: "ios" },
  apiBaseUrl: undefined, // default https://tracern-api.devlys.com
});
OptionDefaultNotes
apiKey—Required
environment"production"e.g. staging / dev
release—Build / app version string
enableAutoErrorCapturetrueJS exceptions + rejections
enableConsoleCapturefalseForwards console.*
enableAutoBreadcrumbstrueLogs + optional network/state
enableNetworkBreadcrumbstrue**when auto breadcrumbs on
enableAppStateBreadcrumbstrue**when auto breadcrumbs on
enableSessionHeartbeattrueInfo session.start on init
slowNetworkThresholdMs—Warn-level slow fetch event
maxBreadcrumbs50Cap 100
sampleRate1Fraction of info/warn
userId—Also setUser()
tags—String map on every event
apiBaseUrlTraceRN APISelf-host / local

Optional peers (feature-detected):

bash
npm install react-native-device-info @react-native-async-storage/async-storage

Last updated · TraceRN docs