@inslytic/sdk-react
v0.1.4
Published
React hooks and components for Inslytic — AI-powered product analytics
Maintainers
Readme
@inslytic/sdk-react
React hooks and components for Inslytic — AI-powered product analytics.
Install
npm install @inslytic/sdk-reactRequires React 18+.
Usage
Wrap your app with InslyticProvider:
import { InslyticProvider } from "@inslytic/sdk-react";
function App() {
return (
<InslyticProvider config={{ apiKey: "your-api-key" }}>
<YourApp />
</InslyticProvider>
);
}Page views are tracked automatically — no manual setup needed.
Then use the useInslytic hook in any component:
import { useInslytic } from "@inslytic/sdk-react";
function SignupButton() {
const { track } = useInslytic();
return (
<button onClick={() => track("signup_clicked")}>
Sign up
</button>
);
}API
The useInslytic hook returns all functions from @inslytic/sdk-browser:
| Function | Description |
|---|---|
| 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
