import posthog from 'posthog-js' posthog.init('PH_PROJECT_API_KEY', { api_host: 'https://posthog.your-company.internal', capture_pageview: false
}) // Identify after login (stable user id)
posthog.identify(user.id, { email: user.email, plan: user.plan
}) // Capture a high-signal product event
posthog.capture('checkout_completed', { value: cart.total, currency: 'USD', items_count: cart.items.length, payment_provider: 'stripe'
})
import posthog from 'posthog-js' posthog.init('PH_PROJECT_API_KEY', { api_host: 'https://posthog.your-company.internal', capture_pageview: false
}) // Identify after login (stable user id)
posthog.identify(user.id, { email: user.email, plan: user.plan
}) // Capture a high-signal product event
posthog.capture('checkout_completed', { value: cart.total, currency: 'USD', items_count: cart.items.length, payment_provider: 'stripe'
})
import posthog from 'posthog-js' posthog.init('PH_PROJECT_API_KEY', { api_host: 'https://posthog.your-company.internal', capture_pageview: false
}) // Identify after login (stable user id)
posthog.identify(user.id, { email: user.email, plan: user.plan
}) // Capture a high-signal product event
posthog.capture('checkout_completed', { value: cart.total, currency: 'USD', items_count: cart.items.length, payment_provider: 'stripe'
}) - Event analytics (funnels, retention, cohorts)
- Feature flags + experimentation (close to where you ship)
- Session replay (debugging UX issues)
- Basic surveys (depending on setup and plan) - Infrastructure (DB, storage, egress)
- On-call responsibility
- Upgrade management
- Capacity planning during traffic spikes - Docker Compose: fastest to try locally or for small internal apps.
- Kubernetes/Helm: the “grown-up” route for reliability and scaling. - Database performance (PostHog commonly uses ClickHouse for analytics workloads)
- Storage growth (session replay can balloon quickly)
- Retention policies (to keep costs predictable)
- Version upgrades (don’t ignore release notes) - Mixpanel: typically smoother for pure event analytics and polished reporting workflows. If your org lives in dashboards and non-technical PMs drive analysis, Mixpanel is hard to beat.
- Amplitude: strong for behavior analytics at scale, governance, and mature enterprise features. Amplitude often wins when analysis complexity and stakeholder count explode.
- Hotjar: best known for heatmaps and lightweight qualitative UX tools. It’s more “understand the page experience” than “model the product.”
- FullStory: session replay powerhouse with deep debugging and search. It’s often the premium option when replay is mission-critical.
- PostHog: the “builder’s analytics toolkit.” You trade some polish for flexibility and integration with engineering workflows. - Standardize event names (checkout_completed not CheckoutDone, checkoutComplete, etc.).
- Set retention rules early, especially if you enable session replay. - You need data residency or stricter privacy controls.
- You want engineering-led analytics that lives close to your stack.
- You’ll actually use the combo of analytics + feature flags + replay.
- You can support basic ops (or already run Kubernetes/managed databases). - You want zero-maintenance analytics for a broad org.
- You rely heavily on highly polished executive reporting.
- You can’t commit to cost controls (replay + long retention adds up fast).