@flashcatcloud/electron-sdk. The renderer uses the Browser SDK; see Web SDK advanced configuration for its general options.
Initialization options
main.ts
init() returns false when validation fails. The SDK prints the reason in the main-process console and does not start collection, but it does not prevent the application from starting.
Custom upload endpoints
By default, the main process uploads regular RUM events to Flashduty SaaS. You do not need to setsite or proxy.
Use a self-hosted intake host
If your intake supports HTTPS and receives events at/api/v2/rum, set its host in site. Do not include https:// or a path:
main.ts
https://rum.example.internal/api/v2/rum.
Use a custom forwarding endpoint
Useproxy when:
- The intake only supports HTTP.
- The upload path is not
/api/v2/rum. - Clients must access the intake through a shared gateway.
main.ts
proxy is a RUM forwarding endpoint that you provide, not an operating-system or Electron network proxy. The main process adds the target path to the request. Your forwarding service must preserve the request body and DD-API-KEY header and send the request to the Flashduty intake.
After you set proxy, the main process no longer uses site to build the upload URL.
Configure a self-hosted Session Replay endpoint
Regular RUM events go through the main process, but the renderer uploads Session Replay directly. As a result, the main-processsite or proxy does not apply to replay segments.
For self-hosted Session Replay, set the Browser SDK proxy in the renderer:
renderer.ts
connect-src directive.
Upload batching and frequency
The main process writes regular RUM events to the application’suserData directory before uploading them in batches. A batch is deleted only after a successful upload.
During integration testing, use
batchSize: 'SMALL' and uploadFrequency: 'FREQUENT' to see events sooner. Keep the defaults for normal operation.
Disk buffering and retry apply only to regular RUM events. The renderer uploads Session Replay directly, so replay does not use the main-process disk buffer.
Collect third-party pages
The current window’s page can always use the bridge; you do not need to setallowedWebViewHosts for it. Add hosts only when you want to collect a third-party page loaded in a <webview> or BrowserView:
main.ts
example.com also allows app.example.com.
Identify the signed-in user
After sign-in, callsetUser() in the main process. Main-process events and bridged renderer events will carry the same user identity.
main.ts
When Session Replay is enabled, also call
flashcatRum.setUser() and flashcatRum.clearUser() in the renderer as part of the same sign-in and sign-out flow, because replay segments bypass the main process.
Report handled errors
An exception caught bytry/catch in the main process is not reported as an unhandled error. Call addError() to record it:
main.ts
context to filter and identify the business workflow.
End the current session
CallstopSession() when a user signs out or when you need to start a new session:
main.ts
Performance metrics for pre-created windows
Electron applications can create a hiddenBrowserWindow, load its page, and show it later. By default, the SDK rebases FCP and LCP on the first time the window becomes visible so the pre-warm delay is not counted as page performance.
To keep the raw document Paint Timing values, disable correction:
main.ts
BrowserWindow. It does not correct metrics from WebContentsView or <webview>.
Customize error stack paths
By default, the SDK rewrites stack paths under the application directory toapp:///<relative path>, allowing one source map upload to match installations on different machines. Most applications do not need to change this behavior.
If your build output layout does not match the application directory, use normalizeStackPath:
main.ts
undefined, the SDK applies its default normalization. See Electron error symbolication for upload instructions.
Related pages
SDK integration
Instrument the main and renderer processes.
Error symbolication
Upload JavaScript source maps and native crash symbols.
Data collection
Review collected data types and upload behavior.
Troubleshooting
Diagnose bridge, replay, and upload issues.