AdvaitaADVAITA DOCS
GitHubGet started
Getting Started10 min

Quickstart

Install the Advaita SDK and send your first event in under five minutes. This guide uses the JavaScript SDK — swap the tab for Python or Node.js.

Prerequisites

  • An Advaita account — sign up here
  • A Project created in the dashboard (Settings → Projects → New Project)
  • Your API Key and Project ID from the dashboard

Never expose your API key in client-side code. For browser SDKs use the public write-only key. For server SDKs use environment variables.

1. Install the SDK

Shell
$ npm install @advaita/js-sdk

2. Initialise

Create a single Advaita instance at your application's entry point and export it for use across your codebase.

JavaScript
import { Advaita } from '@advaita/js-sdk'
const advaita = new Advaita({
apiKey: 'YOUR_API_KEY',
projectId: 'YOUR_PROJECT_ID',
})

3. Track your first event

Call track() with an event name and a properties object. Event names should be in snake_case. Properties can be any JSON-serialisable values.

JavaScript
advaita.track('button_clicked', {
button_id: 'upgrade_cta',
page: '/pricing',
plan: 'pro',
})

Events are batched automatically and flushed every 5 seconds or when 20 events accumulate — whichever comes first. No manual flush needed in most cases.

4. Identify a user

Call identify() after a user signs in or signs up. This links all future events to that user's profile and enables cohort analysis.

JavaScript
advaita.identify('user_8291', {
email: 'jane@example.com',
name: 'Jane Smith',
plan: 'pro',
created_at: '2024-03-15',
})

5. Verify in the dashboard

Open your Advaita dashboard and navigate to Clickstream → Live Events. You should see your events appear within a few seconds.

Live Events — 3 received
14:22:01button_clickeduser_8291OK
14:22:00page_viewuser_8291OK
14:21:58session_startanon_4421OK

Next steps