Quick Start
Get up and running with Realanalytics in 5 minutes
1. Install the SDK
npm install @realanalytics/sdk2. Initialize the client
import { createClient } from '@realanalytics/sdk'
const analytics = createClient({
publicKey: 'pk_live_xxx' // Get this from your dashboard
})3. Track your first event
analytics.track('button_clicked', {
button: 'signup',
page: '/pricing'
})4. Define a dashboard
Create a file called analytics.config.ts in your project:
import { defineDashboard } from '@realanalytics/sdk'
export const dashboard = defineDashboard({
id: 'overview',
title: 'My Dashboard',
widgets: [
{
type: 'metric',
label: 'Button Clicks',
event: 'button_clicked'
}
]
})5. Deploy
npx realanalytics deployThat's it! Your dashboard is now live at your Realanalytics account.