Integrate Pug
Event analytics and user profiles you can wire into any app. Install an SDK or POST straight to the API, watch events flow through the pipeline, and query them back out — self-host the whole thing if you want to.
import { init, track } from '@pug-sh/browser'
init('YOUR_PROJECT_ID', {
apiKey: 'pub_YOUR_PUBLIC_KEY'
})
track('page_view')import 'package:pug_flutter/pug_flutter.dart';
await Pug.init(
'YOUR_PROJECT_ID',
const PugOptions(apiKey: 'pub_YOUR_PUBLIC_KEY'),
);
Pug.track('page_view');import { Pug } from '@pug-sh/node'
// Server-side — authenticate with your private key.
const pug = new Pug({ apiKey: process.env.PUG_PRIVATE_KEY! })
// A server has no ambient user — name the distinctId.
pug.track('user-123', 'page_view')# No SDK? POST events to the Connect RPC ingest endpoint.
# See /docs/sdks for the full request shape.
curl -X POST https://api.pugs.dev/sdk.events.v1.EventsService/BatchCreate \
-H "x-api-key: pub_YOUR_PUBLIC_KEY" \
-H "Connect-Protocol-Version: 1" \
-H "Content-Type: application/json" \
-d '{"events":[{"eventId":"01J9...","kind":"page_view","distinctId":"anon-1","sessionId":"01J9...","occurTime":"2026-06-05T10:00:00Z"}]}'Events flow from your app through an async pipeline to analytics storage. The same data powers Live, Insights, and Profiles.
Web app
Install the Web SDK (@pug-sh/browser) — auto-track page views and clicks, identify users on sign-in.
Quickstart →Mobile app
Typed event tracking, screen and lifecycle auto-tracking, and identity for Flutter apps.
Flutter setup →Backend or any language
Send events and read analytics from a Node.js backend with the Node SDK — or POST straight to the Connect RPC API from any other language.
Node SDK →Query your data
Read insights and profiles programmatically with your private key — via the Node SDK or the Connect API.
API reference →Self-host
Run the full stack — Postgres, ClickHouse, NATS, Dragonfly, and the Go workers — on your own infrastructure.
Self-hosting guide →Jump straight in
Copy-paste SDK snippets for tracking events and identifying users.
import { track } from '@pug-sh/browser'
track('button_clicked', { label: 'Sign up' })
track('purchase', {
productId: 'sku_123',
amount: 29.99,
currency: 'USD'
}, { immediate: true })import { identify, reset } from '@pug-sh/browser'
await identify('user-123', {
email: '[email protected]',
plan: 'pro'
})
reset()