Skip to Content
DocsSDKsWebOverview

Web SDK

Browser-side analytics for Pug. Auto-captures page views, clicks, and form interactions; batches events efficiently; and manages identity and sessions.

Package: @poluruprvn/pug-web
Repo: cotton-web-sdk 
Transport: Connect RPC over HTTPS

Features

FeatureDescription
Auto-trackingPage views, clicks, scroll, forms, frustration signals
BatchingQueue + timer flush with localStorage persistence
Identityidentify(), reset(), cross-tab session sync
Well-known eventsTypeScript types generated from protobuf schemas
SPA supportHistory API hooks for client-side routing

Quick example

import { init, track, identify } from '@poluruprvn/pug-web' init('YOUR_PROJECT_ID', { apiKey: 'YOUR_SDK_API_KEY', endpoint: 'https://api.pug.sh' }) track('page_view') // After sign-in identify('user-123', { email: 'user@example.com', plan: 'pro' })

Integration checklist

Browser support

BrowserSupport
Chrome 90+Full
Firefox 90+Full
Safari 15+Full
Edge 90+Full

Requires fetch, localStorage, and HTTPS in production.

Topics

Last updated on