Quick start (npm)
Install the FirstDistro SDK with npm install @firstdistro/sdk. React and Next.js. 14-day free trial. Get running in under 5 minutes.
Get FirstDistro running in your React or Next.js app in under 5 minutes. New here? Start a 14-day free trial (no credit card required).
1. install
npm install @firstdistro/sdk
2. add the provider
Wrap your app with FirstDistroProvider and pass your installation token.
// app/providers.tsx
'use client'
import { FirstDistroProvider } from '@firstdistro/sdk/react'
export function Providers({ children }: { children: React.ReactNode }) {
return (
<FirstDistroProvider token={process.env.NEXT_PUBLIC_FIRSTDISTRO_TOKEN!}>
{children}
</FirstDistroProvider>
)
}
// app/layout.tsx
import { Providers } from './providers'
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html>
<body>
<Providers>{children}</Providers>
</body>
</html>
)
}
Get your token: Dashboard → Settings → SDK Configuration
3. identify users
Use the useFirstDistroSetup hook to identify users when they log in.
'use client'
import { useFirstDistroSetup } from '@firstdistro/sdk/react'
export function UserIdentifier({ user, organization }: { user: User; organization: Org }) {
useFirstDistroSetup({
userId: user.id,
userEmail: user.email,
userName: user.name,
accountId: organization.id,
accountName: organization.name,
accountPlan: organization.plan,
})
return null
}
Note: Account context (accountId) is required for Customer Insights to calculate health scores. Without it, events are stored but not processed.
4. track events
Use the useTrack hook to track product usage events.
'use client'
import { useTrack } from '@firstdistro/sdk/react'
function ExportButton() {
const track = useTrack()
const handleExport = () => {
track('feature_used', { feature: 'export', format: 'pdf' })
// ... export logic
}
return <button onClick={handleExport}>Export</button>
}
5. verify
Open your browser console. You should see:
[FirstDistro] SDK initialized[FirstDistro] Enabling event tracking
Events appear in your Customer Insights dashboard within seconds.
Next steps
- React Hooks Reference — All available hooks and options
- Event Tracking Guide — Best practices for tracking events
- MCP (AI Assistants) — Query customer health from Claude, Cursor, or Windsurf
Alternative: script tag
If you're not using a bundler, you can install via script tag instead.
See the Installation Guide for script tag instructions.