SDKs
JavaScript
Installation

Installation

Install the Statly Observe SDK for JavaScript and Node.js applications.

Package Installation

npm install @statly/observe

Basic Setup

Initialize the SDK as early as possible in your application:

import { init, captureException } from '@statly/observe';
 
init({
  dsn: 'https://[email protected]/your-org',
  environment: 'production',
});

Get your DSN from Dashboard → Settings → SDK Setup.

Verify Installation

Test that events are being sent:

import { captureMessage } from '@statly/observe';
 
captureMessage('SDK installed successfully', 'info');

Check your Statly dashboard to see the test event.

TypeScript Support

The SDK is written in TypeScript and includes type definitions:

import { init, StatlyOptions } from '@statly/observe';
 
const options: StatlyOptions = {
  dsn: 'https://[email protected]/your-org',
  environment: 'production',
  release: '1.0.0',
};
 
init(options);

Browser vs Node.js

The SDK works in both environments with automatic detection:

Browser

  • Global error handler (window.onerror)
  • Unhandled promise rejections
  • Console error capture
  • Browser/OS detection from user agent

Node.js

  • Process uncaughtException handler
  • unhandledRejection handler
  • Server-side stack traces
  • Express/Fastify middleware

Next Steps