import posthog from 'posthog-js' posthog.init('YOUR_PROJECT_API_KEY', { api_host: 'https://posthog.yourdomain.com', capture_pageview: false, // avoid noisy defaults if you track routes yourself
}) export function trackSignup({ plan, source }) { posthog.capture('signup_completed', { plan, source, // Avoid sending PII like email unless you have a strong reason + policy timestamp: new Date().toISOString(), })
} // Later, after identifying a user:
posthog.identify('user_123')
import posthog from 'posthog-js' posthog.init('YOUR_PROJECT_API_KEY', { api_host: 'https://posthog.yourdomain.com', capture_pageview: false, // avoid noisy defaults if you track routes yourself
}) export function trackSignup({ plan, source }) { posthog.capture('signup_completed', { plan, source, // Avoid sending PII like email unless you have a strong reason + policy timestamp: new Date().toISOString(), })
} // Later, after identifying a user:
posthog.identify('user_123')
import posthog from 'posthog-js' posthog.init('YOUR_PROJECT_API_KEY', { api_host: 'https://posthog.yourdomain.com', capture_pageview: false, // avoid noisy defaults if you track routes yourself
}) export function trackSignup({ plan, source }) { posthog.capture('signup_completed', { plan, source, // Avoid sending PII like email unless you have a strong reason + policy timestamp: new Date().toISOString(), })
} // Later, after identifying a user:
posthog.identify('user_123') - Product analytics (events, funnels, retention, cohorts)
- Autocapture (clicks, pageviews, elements) if you want it
- Session replay (similar category to hotjar and fullstory)
- Feature flags + A/B testing (a huge plus if you don’t want to add another vendor)
- Data warehouse exports / pipelines (depending on your setup) - ClickHouse management: PostHog leans heavily on ClickHouse. It’s fast and great for analytics, but you’re now responsible for performance, disk, and backups.
- Storage growth: events + replays can balloon. Replays are the silent killer.
- Upgrades: PostHog ships quickly. Staying current is good for security and features, but it means you need a process.
- Observability: you’ll want dashboards/alerts (CPU, memory, disk IO, ClickHouse latency, ingestion lag). - PII handling: decide what to capture, mask, or drop at ingestion
- Retention policies: enforce time limits for events and replays
- Network boundaries: private subnets, VPC peering, internal-only dashboards - PostHog (self-hosted): best if you want an integrated stack (analytics + flags + experiments + replay) and you’re willing to run infra.
- mixpanel: excellent product analytics UX and reporting polish. If you want fewer operational concerns and can use SaaS, it’s often faster to value.
- amplitude: strong for advanced behavioral analytics and org-scale governance—again, typically chosen as a SaaS-first bet.
- hotjar: great for lightweight qualitative insight (heatmaps, feedback) rather than deep event modeling.
- fullstory: session replay leader vibe; powerful but can be pricey and replay-heavy by design. - Compliance or customer requirements that push you away from SaaS
- An infra team that’s comfortable operating ClickHouse + backups
- A desire to unify analytics, feature flags, and experiments - Don’t have time to own upgrades, storage tuning, and on-call risk
- Only need a small slice of analytics and want the simplest path