Product analytics for React
Pug’s Web SDK is plain framework-agnostic JavaScript, so it works in any React app — Vite, CRA, or anything else. Call init() once where your app boots and autocapture takes over.
Uses the Pug Web SDK — Pug’s one framework-agnostic SDK for the browser.
npm install @poluruprvn/pug-web // src/main.tsx — runs once when the app boots
import { init } from '@poluruprvn/pug-web'
init('your-project-id', { apiKey: 'pub_your_key' })
// Then track your own events anywhere in the tree:
import { identify, track } from '@poluruprvn/pug-web'
identify('user_123', { email: '[email protected]', plan: 'pro' })
track('signup', { plan: 'pro' }) Product analytics in your React app
- Autocapture: page views, clicks, scrolls, form interactions, rage clicks, and dead clicks — after one init(), no per-event code
- identify() merges anonymous and signed-in activity into one profile per person, across devices
- track() for your own named events, with typed properties
- Trends, funnels, retention cohorts, segmentation, user flows, and top-K over every event
Pug + React — common questions
Do I need a React-specific package?
No. There is one Pug Web SDK and it is framework-agnostic. In React you import @poluruprvn/pug-web and call init() once at startup — no provider or hook library required.
Where should I call init()?
At your app’s entry point (e.g. main.tsx), so it runs once before the tree renders. Autocapture then records page views, clicks, scrolls, and form interactions; call identify() on sign-in and track() for custom events.
Does it support single-page-app route changes?
Yes — the Web SDK records virtual page views as your router changes the URL, so client-side navigation in a React SPA is captured without extra wiring.
Add Pug to your React app.
Open-source product analytics with unified profiles. Self-host under AGPL-3.0, or use the free cloud during open beta.