SDKs

Eight SDKs, one profile per person

Web, Android, iOS, React Native, Flutter, Node, Go, and Ruby have shipped since July 2026. Each sends to the same pipeline, so one person’s web, app, and server events land on the same profile.

import { init, identify, track } from '@pug-sh/browser'

init('your-project-id', { apiKey: 'pub_your_key' })
// Page views, clicks, scrolls, form interactions, rage clicks
// and dead clicks are captured automatically from here on.

identify('user_123', { email: 'ada@example.com', plan: 'pro' })
track('signup', { plan: 'pro' })
track('order_completed', { amount: 49.0, currency: 'USD' })
import sh.pug.android.Options
import sh.pug.android.Pug

Pug.init(this, "your-project-id", Options("pub_your_key"))
// Call once in Application.onCreate(). Lifecycle, screen
// views and installs are tracked automatically from here.

Pug.identify("user_123", mapOf("plan" to "pro"))
Pug.track.purchase(amount = 49.0, currency = "USD")
import Pug
do {
  try Pug.initialize(
    projectId: "your-project-id",
    options: Pug.Options(apiKey: "pub_your_key"))
} catch { assertionFailure("Pug was not started: \(error)") }
// App opens, screen views and installs are tracked from here.
Pug.identify("user_123", traits: ["plan": "pro"])
Pug.track.purchase(amount: 49.0, currency: "USD")
import { identify, init, track } from '@pug-sh/react-native'

init('your-project-id', { apiKey: 'pub_your_key' })
// Once, in the app's entry file. App opens, closes, installs
// and updates are tracked from here; trackNavigation(ref)
// adds a screen view for each route your navigator shows.

identify('user_123', { plan: 'pro' })
track('purchase', { amount: 49.0, currency: 'USD' })
import 'package:pug_flutter/pug_flutter.dart';

await Pug.init('your-project-id',
    const PugOptions(apiKey: 'pub_your_key'));
// Auto-tracking starts immediately. Identify users on sign-in:
await Pug.identify('user_123', traits: {'plan': 'pro'});

// Typed methods for well-known events, custom props in extras:
Pug.track.signup(extras: {'plan': 'pro'});
import { Pug } from '@pug-sh/node'

const pug = new Pug({ apiKey: process.env.PUG_PRIVATE_KEY })

// Server events name the user explicitly: no ambient session.
pug.track('user_123', 'order_completed', { amount: 49.0 })
await pug.identify('user_123', { email: 'ada@example.com' })
// Private keys can also read: profiles and insight queries.
const profile = await pug.profiles.getByExternalId('user_123')
import pug "github.com/pug-sh/sdk-go"
key := os.Getenv("PUG_PRIVATE_KEY") // private key, prv_...
client, err := pug.New(pug.Options{APIKey: key})
if err != nil {
	log.Fatal(err) // no key, or not a prv_ key
}
defer client.Close(context.Background()) // drains the queues
client.Track("user_123", "signup", pug.String("plan", "pro"))
client.Identify("user_123", pug.Email("ada@example.com"))
require "pug"

pug = Pug::Client.new(api_key: ENV.fetch("PUG_PRIVATE_KEY"))

# Server events name the user explicitly: no ambient session.
pug.track("user_123", "order_completed", amount: 49.0)
pug.identify("user_123", email: "ada@example.com", plan: "pro")
# Private keys can also read: profiles and insight queries.
profile = pug.profiles.get_by_external_id("user_123")
Available now

Client and server SDKs

The client SDKs (Web, Android, iOS, React Native, and Flutter) use your public key, which is safe to ship in an app bundle. The server SDKs (Node, Go, and Ruby) use a private key, which can also read profiles and insights.

Since July 2026

Web

Autocapture, sessions, consent states, and batched delivery for any website or web app.

npm install @pug-sh/browser
Since October 2026

Android

Native Kotlin SDK, also callable from Java, on two runtime dependencies. Tracks app lifecycle, installs, and each activity as a screen; a composable or fragment is named with Pug.screen.

implementation("sh.pug:android:0.3.0")
Since November 2026

iOS

Native Swift SDK for iOS, iPadOS, and Mac Catalyst, with no runtime dependencies. Tracks app lifecycle, installs, and each view controller as a screen; a SwiftUI screen is named with .pugScreen.

.package(url: "https://github.com/pug-sh/sdk-ios.git", from: "0.2.0")
Since December 2026

React Native

For React Native 0.83 or newer on the New Architecture, in bare apps and Expo development builds, on the Android and iOS SDKs. Tracks app lifecycle and installs; trackNavigation names each React Navigation or Expo Router screen.

npm install @pug-sh/react-native
Since July 2026

Flutter

Tracks app opens and installs on its own, with identity and sessions. On Android and iOS, each route change is a screen view once PugRouteObserver is on the navigator.

flutter pub add pug_flutter
Since July 2026

Node

Server-side events that name the user on every call, plus profile and insight reads.

npm install @pug-sh/node
Since October 2026

Go

Server-side events plus profile and insight reads for Go 1.26+, with typed properties and well-known events checked at compile time. Tracking never fails or waits on the network.

go get github.com/pug-sh/sdk-go
Since October 2026

Ruby

Server-side events plus profile and insight reads from Rails or plain Ruby, thread- and fork-safe under Puma and Sidekiq.

bundle add pug-sh
Available

HTTP API

From any other language, a POST of JSON sends events and identifies users through the same Connect API the SDKs call.

POST https://api.pugs.dev
Since November 2026

AI crawlers

Reports each request from a known crawler, such as GPTBot or ClaudeBot, from your site’s own request handling, after the response. It has no dependencies and runs on Cloudflare Workers, Vercel and Next.js, Hono, Bun, Deno, Express, and plain Node.

npm install @pug-sh/crawlers
On the roadmap

Rust, Java, and Python server SDKs are in development.

They use the same events and identity model as the SDKs above.

Send your first event.

Create a project, add the snippet, and watch the Live view fill up. Or open the demo first: the real dashboard on a sample pet shop, with no sign-up.

Questions? Email hello@pug.sh