PostHog Event Schema Builder
Design your PostHog analytics event schema visually. Define events with typed properties,
add person properties for user segmentation, and generate ready-to-use
posthog.capture() code for
Browser JavaScript, Node.js, and Python — plus TypeScript interfaces.
Frequently Asked Questions
What is PostHog and what is event tracking?▼
PostHog is an open-source product analytics platform. Event tracking means recording user actions — like button clicks, form submissions, or page views — as discrete named events with properties describing the context. These events let you understand how users interact with your product, funnel through flows, and what drives retention or churn.
What is the difference between event properties and person properties?▼
Event properties describe the specific action that happened — like which button was clicked, the plan selected, or the page visited. They're passed in the properties object of posthog.capture(). Person properties describe the user themselves — like their email, subscription plan, or signup date — and are set via posthog.identify(). Person properties persist across events and let you segment users.
What naming convention should I use for events?▼
PostHog recommends snake_case for event names (e.g. user_signed_up, checkout_started, feature_used). Use consistent noun-verb or verb-noun patterns across your codebase. Avoid spaces and special characters. Prefix events by area if you have many (e.g. auth_login_clicked, billing_plan_upgraded). Good naming makes autocomplete and search much faster as your event library grows.
How do I use this in a Next.js or React app?▼
Install posthog-js: npm install posthog-js. In your _app.tsx or layout.tsx, call posthog.init('YOUR_API_KEY', { api_host: 'https://app.posthog.com' }). Then anywhere in your components, import posthog and call posthog.capture('event_name', { ...properties }). Use the generated code from this tool directly — just replace the example values with real variables.
What is the distinctId in posthog.capture()?▼
The distinctId uniquely identifies the user or session. For logged-in users, use your internal user ID (e.g. user.id from your database). For anonymous users, PostHog auto-generates a UUID on init and stores it in localStorage. After a user logs in, call posthog.identify(userId) to link the anonymous events to the identified user — this is called alias merging.
Should I track events server-side or client-side?▼
Client-side tracking (browser JS) is easiest and captures the most detail, but ad blockers can interfere. Server-side tracking (Node.js or Python SDK) is more reliable and can't be blocked — it's better for critical events like purchases or sign-ups. Many teams use both: client-side for UI interactions, server-side for transactional events. The generated code covers both approaches.
Related Products
on GumroadTypeScript Quick Reference Toolkit
5 practical reference files for TypeScript developers: cheatsheet, TS vs JS comparison, 20 utility types with real examples, tsconfig best practices template, and 15 common mistakes guide. Print it. Keep it on your desk.
Buy on Gumroad →DevToolkit Starter Kit
A ready-to-deploy developer tools website with 12 built-in tools. Astro + Preact + Tailwind. Deploy to Cloudflare Pages for free. Built-in SEO, dark mode, and ad-ready layout.
Buy on Gumroad →DevPlaybook Interview Vault
210+ real technical interview questions with model answers, asked at Google, Meta, Amazon, Microsoft, Stripe, and Shopify. Covers Frontend (55), Backend (55), System Design (50), and DSA (50). Available in English and Traditional Chinese.
Buy on Gumroad →You Might Also Need
SQL to TypeScript Types
Convert SQL CREATE TABLE statements to TypeScript interfaces and Zod schemas. Maps SQL column types to TypeScript with nullability.
Open free tool →
TypeScript Discriminated Union Builder
Build TypeScript discriminated unions visually. Add variants with fields and get type-safe switch statements, type guards, and exhaustive checking code.
Open free tool →
TypeScript Playground
Write TypeScript and instantly see compiled JavaScript output. Strip interfaces, types, generics, enums, and decorators. Share code via URL. No install needed.
Open free tool →
More Free Tools
Related Articles
TypeScript 5.5 New Features: Complete Guide for Developers 2026
Everything you need to know about TypeScript 5.5: inferred type predicates, isolated declarations, JSDoc @import tag, new Set methods, and performance improvements. With practical code examples.
Best Tools for TypeScript Developers (2024)
The best free tools for TypeScript developers. From type checkers and linters to playgrounds and runtime validators, build better TypeScript faster.
Modern JavaScript Stack 2026: Next.js 15, Bun, Vite, TypeScript & Beyond
Explore the modern JavaScript stack for 2026: Next.js 15, Bun, Vite, TypeScript 5.4, React Server Components, and the best tooling choices for full-stack developers.
Node.js ESM vs CommonJS: Migration Guide for 2026
Complete guide to migrating from CommonJS to ES Modules in Node.js. Covers interop rules, package.json configuration, TypeScript settings, dual package publishing, and common migration pitfalls.
TypeScript 5.x Advanced Patterns: Template Literal Types, Variadic Tuple Types, and Satisfies Operator
Deep dive into TypeScript 5.x advanced type system features: template literal types, variadic tuple types, the satisfies operator, and const type parameters with real-world examples.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →