@inslytic/sdk-browser
v0.1.4
Published
Browser tracking SDK for Inslytic — AI-powered product analytics
Maintainers
Readme
@inslytic/sdk-browser
Browser tracking SDK for Inslytic — AI-powered product analytics. ~2.5KB gzipped.
Install
npm install @inslytic/sdk-browserUsage
import { init, track, identify, page, setConsent } from "@inslytic/sdk-browser";
// Initialize with your project API key
init({ apiKey: "your-api-key" });
// Track events
track("button_clicked", { properties: { button: "signup" } });
// Identify users
identify("user-123");
// Page views are tracked automatically — no manual calls needed
// Set consent (required before data is stored)
setConsent(true);Configuration
init({
apiKey: "your-api-key",
endpoint: "https://api.inslytic.com", // default
flushInterval: 2000, // batch flush interval in ms
maxBatchSize: 20, // max events per batch
debug: false, // enable debug logging
autoPageTracking: true, // auto-track page views (default: true)
});API
| Function | Description |
|---|---|
| init(config) | Initialize the SDK |
| track(event, options?) | Track a custom event |
| identify(userId, traits?) | Associate events with a user |
| page(properties?) | Manually track a page view (automatic by default) |
| setConsent(granted) | Set user consent status |
| reset() | Clear user identity and stop tracking |
License
MIT
