Session replay and user monitoring SDK. Record, replay and analyze user sessions with automatic error detection, performance monitoring, and AI-powered bug fixing. Includes CLI for sourcemap uploads.
npm install @sonarly/trackerbash
npm install @sonarly/tracker
`
---
Quick Start
$3
`javascript
import Tracker from '@sonarly/tracker'
const tracker = new Tracker({
projectKey: 'YOUR_PROJECT_KEY', // Get from Sonarly dashboard
ingestPoint: 'https://api.sonarly.dev/ingest',
})
// Start recording
tracker.start({
userID: 'user@example.com',
metadata: {
plan: 'premium',
version: '2.1.0',
},
})
`
$3
`javascript
tracker.setUserID('john.doe@company.com')
tracker.setMetadata('subscription', 'enterprise')
`
$3
`javascript
tracker.event('purchase_completed', {
amount: 99.99,
currency: 'USD',
})
// Report issues manually
tracker.issue('Payment Gateway Timeout', { gateway: 'stripe' })
`
---
API Reference
`javascript
// Session control
tracker.start(options?)
tracker.stop()
tracker.getSessionInfo() // Returns: { sessionID, sessionToken, userID, metadata }
// User identification
tracker.setUserID('user@example.com')
tracker.setUserAnonymousID('anon-12345')
// Custom data
tracker.setMetadata('key', 'value')
tracker.event('event_name', { data: 'value' })
tracker.issue('Issue description', { context: 'data' })
`
---
Privacy Controls
`html
Secret content
Sensitive text
`
Password fields and credit card numbers are automatically protected.
---
What Gets Captured?
Automatically captured:
- DOM changes and user interactions
- JavaScript errors and console logs
- Network requests (fetch, XHR)
- Web Vitals and performance metrics
- Rage clicks and dead clicks
Never captured:
- Password fields
- Credit card numbers
- Elements marked with data-sonarly-hidden`