Skip to Content
DocsSDKsOverview

SDKs

Client libraries for sending events and managing identity from your applications. All SDKs share the same mental model — init once, track events, identify users.

Platform support

Web

Browser analytics with auto-tracking, batching, and sessions — @poluruprvn/pug-web. Available now.

Web docs

Flutter

Native tracking for Flutter apps. Coming soon.

Flutter docs

Android

Native Android SDK. Coming soon.

Android docs

iOS

Native iOS SDK. Coming soon.

iOS docs

Start with the Web SDK for browser analytics. Mobile platforms can integrate via the Events API until native SDKs ship.

Shared mental model

Every SDK follows the same lifecycle:

init(projectId, options) ← once at app startup ├── track(name, props) ← throughout the app ├── identify(id, traits) ← after sign-in └── reset() ← on sign-out

Initialization

Call init once at app startup with your project ID and SDK API key:

init('YOUR_PROJECT_ID', { apiKey: 'YOUR_SDK_API_KEY', endpoint: 'https://api.pug.sh' })

See Initialization for all options.

Tracking

track('event_name', { property: 'value' }) track('purchase', { revenue: 29.99, currency: 'USD' }, { immediate: true })

Custom event names are accepted. Well-known events are schema-validated for richer dashboard support.

Identity

identify('user-123', { email: 'user@example.com', plan: 'pro' })

Merges anonymous activity into a known profile. Call after sign-in; call reset() on sign-out.

Sessions

Sessions group events within a visit. SDKs manage session IDs automatically:

  • New session after inactivity timeout (default 30 minutes)
  • Session extended on each event within the window
  • Web SDK syncs session ID across browser tabs via localStorage

Batching

Events are queued and flushed in batches for performance:

  • Default batch size and flush interval are tuned for browser/mobile
  • Priority events bypass the queue with { immediate: true }
  • Web SDK persists the queue in localStorage across page reloads

Failed batches are retried automatically. Events are never silently dropped unless dryRun: true.

Auto-properties

SDKs attach context automatically:

PropertySource
$url, $referrer, UTM paramsWeb SDK
$screen, $sdkVersionAll SDKs
$geo.*, $browser, $botScoreServer enrichment

See Auto-properties.

Choosing an integration path

I want to…Start here
Track website visitorsWeb SDK quickstart
Track a React/Next.js appInstallation → Next.js
Send events from my backendEvents API
Query analytics programmaticallyInsights API with shared key
Track a Flutter/Android/iOS appMobile interim guides

Authentication

SDKs use the SDK API key from project settings. Never expose a shared/private key in client code.

Authorization: Bearer <sdk-api-key> x-project-id: <project-id>

See Authentication.

Further reading

Last updated on