Talaria

Docs / SDKs / JavaScript

JavaScript SDK

Browser SDK (@newtalaria/browser) — error capture and session replay in the browser.

Using Silverstripe? The Silverstripe module can load this package automatically on CMS and frontend pages.

Install

bash
npm install @newtalaria/browser

Configure

Use a project API key (tal_live_…). Talaria.init installs window.onerror and unhandledrejection handlers unless you pass disableDefaultIntegrations: true.

talaria.tstypescript
import { Talaria } from '@newtalaria/browser';

Talaria.init({
  dsn: 'https://api.newtalaria.com',
  apiKey: 'tal_live_…',
  environment: 'production', // production | staging | development
  release: '1.0.0',
  // Continuous session upload (0–1). Default 0 = buffer until an error.
  replaysSessionSampleRate: 0,
  // On error, promote the ~60s ring buffer (0–1). Default 1.
  replaysOnErrorSampleRate: 1,
  maskAllInputs: true,
});

Capture exceptions

typescript
try {
  throw new Error('Something broke');
} catch (error) {
  await Talaria.captureException(error, {
    tags: { area: 'checkout' },
  });
}

await Talaria.captureMessage('Checkout opened', 'info');
console.log('replay', Talaria.getReplayId());

await Talaria.flush();
await Talaria.close();

CDN (ESM)

Load from jsDelivr without a bundler. Pin a published version:

html
<script type="module">
  import { Talaria } from 'https://cdn.jsdelivr.net/npm/@newtalaria/[email protected]/+esm';

  Talaria.init({
    dsn: 'https://api.newtalaria.com',
    apiKey: 'tal_live_…',
    environment: 'production',
    replaysSessionSampleRate: 0,
    replaysOnErrorSampleRate: 1,
  });
</script>

Script tag (IIFE)

For hosts without modules (for example Silverstripe Requirements), serve the built IIFE from dist/talaria.browser.iife.js:

html
<script src="/path/to/talaria.browser.iife.js"></script>
<script>
  Talaria.init({
    dsn: 'https://api.newtalaria.com',
    apiKey: 'tal_live_…',
    environment: 'production',
    replaysSessionSampleRate: 0,
    replaysOnErrorSampleRate: 0,
  });
</script>

Session replay sampling

You pay for uploaded and retained replay bytes. Defaults (replaysSessionSampleRate: 0, replaysOnErrorSampleRate: 1) keep quiet traffic cheap: buffer locally, upload a clip when an error is sampled. Raise continuous session sampling only when you need always-on playback.

Environments & releases

Set environment to production, staging, or development (aliases like prod / dev are accepted), and optional release from your deploy so issues correlate with builds.

Troubleshooting

  • 401/403 — check API key and that it belongs to the target project.
  • No issue appears — confirm environment filter in the dashboard.
  • Rejected events — validate JSON shape against the API overview.

Prefer another platform? See all SDKs or send events over HTTP via the API overview.