Licence
MIT
Version
0.4.0
Deps
2
Size
2.4 MB
Vulns
0
Weekly
663
@flamioai/web-sdk
Lightweight JavaScript SDK for continuous UX session recording on production sites. Captures rrweb recordings, console errors, network failures, and Web Vitals — batches and uploads to FlamioAI for real-time analysis.
Installation
npm install @flamioai/web-sdkUsage
<script type="module">
import { Flamio } from '@flamioai/web-sdk';
Flamio.init({
projectKey: 'flm_your_project_key',
endpoint: 'https://api.flamio.org/api',
sampleRate: 1.0,
maskAllInputs: true,
});
</script>API
Flamio.init(config)
Start recording. Returns the Flamio instance or null if not sampled.
| Option | Type | Default | Description |
|---|---|---|---|
projectKey |
string |
required | API key from project settings |
endpoint |
string |
required | FlamioAI ingestion endpoint |
sampleRate |
number |
1.0 |
0-1, fraction of sessions to record |
consent |
'granted' | 'denied' | 'wait' |
'granted' |
Consent mode |
maskAllInputs |
boolean |
true |
Mask all input values |
batchInterval |
number |
5000 |
Upload interval in ms |
batchMaxSize |
number |
50000 |
Max buffer size before flush |
Flamio.identify(userId, traits?)
Associate the session with a user ID.
Flamio.consent(status)
Update consent status. Pass 'granted' to start recording, 'denied' to stop.
Flamio.stop()
Stop recording and flush remaining data.
What it captures
- rrweb DOM recordings (privacy-masked)
- Console errors and warnings
- Network failures (status >= 400)
- Web Vitals (LCP, INP, CLS)
License
MIT