@lucenthq/sdk
v0.0.5
Published
Lucent session replay SDK — record, capture, and analyze user sessions
Readme
@lucenthq/sdk
Session replay SDK for Lucent — record, capture, and analyze user sessions with rrweb.
Installation
npm install @lucenthq/sdkQuick Start
import { LucentTracker } from "@lucenthq/sdk";
const tracker = new LucentTracker({
publicKey: "luc_pk_...",
ingestBaseUrl: "https://your-api.example.com",
});Recording starts automatically. To disable auto-start, pass autoStart: false and call tracker.start() manually when you're ready.
React / Next.js
import { LucentProvider, LucentIdentify } from "@lucenthq/sdk/react";
function App({ children }) {
return (
<LucentProvider publicKey="luc_pk_..." options={{ ingestBaseUrl: "https://your-api.example.com" }}>
<LucentIdentify userId={user?.id} email={user?.email} />
{children}
</LucentProvider>
);
}Configuration
new LucentTracker({
publicKey: "luc_pk_...",
ingestBaseUrl: "https://your-api.example.com",
capture: {
console: true, // Capture console.log/warn/error
network: true, // Capture fetch/XHR requests
clicks: true, // Default
inputs: true, // Default
canvas: false, // Default
},
privacy: {
mode: "privacy-first", // Mask all text by default
},
detection: {
rageClickThreshold: 3, // Default: 3 clicks in 1s
deadClickTimeoutMs: 500, // Default: 500ms no mutation
},
sampling: {
sessionReplay: 1.0, // 0.0 - 1.0
},
});API
LucentTracker
start()— Begin recording (called automatically unlessautoStart: false)stop()— Stop recording and flushidentify(user)— Identify the current userresetIdentity()— Clear user identitytrack(name, properties?)— Track a custom eventflush()— Manually flush the event queuegetSessionInfo()— Get current session/window IDs
React
<LucentProvider>— Initialize and manage the tracker lifecycle<LucentIdentify>— Sync user identity with the trackeruseLucent()— Access the tracker instance from context
