PostHog vs Mixpanel vs Heap 2026
Product analytics platforms have diverged significantly in 2026. PostHog has expanded beyond analytics into a full developer platform — feature flags, session replay, A/B testing, error tracking, and LLM analytics in one product. Mixpanel doubled down on funnel analysis and added session replay to compete. Heap maintains its autocapture-first philosophy with the deepest retroactive analysis capability on the market.
Picking the wrong one is expensive: Heap's enterprise pricing is opaque, Mixpanel's event-based billing can surprise you at scale, and PostHog's self-host path requires real infrastructure investment. Here's what you need to know before committing.
The Three Platforms
PostHog
PostHog launched as "the open-source Mixpanel" and has since become something distinct: a developer-first product platform where analytics is one feature among many. The tagline isn't wrong — PostHog Cloud's free tier is genuinely generous (1 million events/month), and the self-host option is real, though the infrastructure requirements are substantial at scale.
The "all-in-one" positioning is genuine in 2026. PostHog includes:
- Product analytics (events, funnels, retention, cohorts)
- Session replay with rage-click detection
- Feature flags and A/B experiments
- Error tracking
- LLM analytics (new in 2026 — tracks costs, latency, and quality for AI features)
- Web analytics (alternative to Google Analytics)
- Surveys
This breadth matters for early-stage teams: you avoid the integration tax of connecting Mixpanel + LaunchDarkly + Sentry + FullStory.
PostHog's data model supports both anonymous and identified users. For B2C apps where most users are anonymous, PostHog becomes dramatically cheaper than Mixpanel because anonymous events cost less.
Pricing (Cloud):
- Free: 1M events/month, 5K session replays, 1M feature flag requests
- Paid: $0.000050/event (1-2M), scaling down to $0.000009/event (250M+)
- No session cap on paid plans beyond free tier allowance
Self-hosting: Free (open-source), but requires PostgreSQL, ClickHouse, Redis, and Kafka. Infrastructure cost estimate: $880-$1,100/month to handle 1M events/month. Cost-effective only at 100M+ events/month.
Mixpanel
Mixpanel is the specialist. It doesn't try to be everything — it tries to be the best funnel analysis and event tracking tool on the market. In 2026, that positioning holds: Mixpanel's funnel visualization, cohort analysis, and real-time event streams are still the benchmark.
The company made a significant pricing change that has driven substantial adoption: the free tier now includes 1 million events/month with core analytics features. Previously, Mixpanel's free tier was limited enough to be nearly useless. Now it's genuinely functional for indie developers and early startups.
Mixpanel added session replay and heatmaps in 2025, closing the gap with PostHog on feature breadth. The implementation is solid, though PostHog's session replay is still considered more complete.
There is no self-host option. Mixpanel is cloud-only, full stop.
Pricing:
- Free: 1M events/month, core analytics
- Growth: starts around $28/month — scales with event volume
- Enterprise: custom (typically $833+/month at scale)
Heap
Heap bets on autocapture. You add the Heap snippet, and it automatically records every click, form submission, page view, and user interaction — without you writing a single tracking call. The pitch: stop missing data because an engineer forgot to add a tracking event.
The retroactive analysis capability is Heap's killer feature. With autocapture, you can go back in time and define events based on interactions that happened months ago. "How many users clicked the export button last quarter?" — you can answer that even if you never explicitly tracked it.
In 2026, Heap offers iOS and Android SDKs alongside web, and their Illuminate feature uses ML to surface insights automatically. Mixpanel and PostHog both offer autocapture now, but Heap's is more complete and has been in production longer.
The challenge: Heap's pricing is enterprise-first. They don't publish pricing on their website, and self-serve signup leads to a sales conversation above 10,000 sessions/month. This opacity makes Heap difficult to evaluate without engaging sales.
Pricing:
- Free: 10,000 sessions/month
- Growth: custom (typically starts around $3,600/year)
- Pro/Enterprise: custom, often $20,000-$100,000+/year at scale
Comparison Table
| Feature | PostHog | Mixpanel | Heap |
|---|---|---|---|
| Free tier | 1M events/month | 1M events/month | 10K sessions/month |
| Pricing at 100K MAU | ~$200-400/month | ~$150-300/month | ~$300+/month (custom) |
| Autocapture | Yes | Yes (added 2025) | Yes (native, deepest) |
| Retroactive analysis | Limited | No | Yes (Heap's signature) |
| Session replay | Yes | Yes (added 2025) | Yes |
| Feature flags | Yes | No | No |
| A/B testing | Yes | No | No |
| Error tracking | Yes | No | No |
| LLM analytics | Yes (2026) | No | No |
| Self-host | Yes (open source) | No | No |
| Pricing model | Events + features | Events | Sessions |
| SDK size (JS) | ~34KB gzipped | ~28KB gzipped | ~18KB gzipped |
| API quality | REST + GraphQL | REST | REST |
Pricing at 100K MAU
This is the number teams ask about most. Let's model a B2C app with 100K monthly active users, each generating roughly 20 events/session, 2 sessions/month — approximately 4 million events/month.
PostHog Cloud:
- 1M free, 3M overage at $0.000050/event = $150
- Session replay (assuming 10% of sessions): ~$50
- Estimated total: ~$200/month
Mixpanel Growth:
- 1M free events, 3M paid — roughly $200-250/month depending on plan tier
- Session replay add-on: additional cost
- Estimated total: ~$250-300/month
Heap:
- 100K MAU is firmly in custom pricing territory
- Typical reported pricing: $300-500/month for this scale
- Estimated total: contact sales
PostHog has a pricing calculator on their website. Mixpanel's pricing page shows growth tiers. Heap requires a sales conversation above the free tier.
Event Tracking Code Examples
Here's how you'd track a "subscription_started" event with each platform in a Next.js app.
PostHog
// lib/analytics.ts
import posthog from 'posthog-js';
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST ?? 'https://app.posthog.com',
person_profiles: 'identified_only', // Don't charge for anonymous
capture_pageview: true,
capture_pageleave: true,
});
export { posthog };
// Usage in your checkout flow
import { posthog } from '@/lib/analytics';
async function handleSubscriptionSuccess(plan: string, userId: string) {
// Identify the user
posthog.identify(userId, {
email: user.email,
name: user.name,
plan,
});
// Track the event
posthog.capture('subscription_started', {
plan,
source: 'checkout',
mrr: getPlanMRR(plan),
});
// Feature flag check — works because PostHog handles both
const showOnboarding = posthog.isFeatureEnabled('new_onboarding_flow');
if (showOnboarding) {
router.push('/onboarding-v2');
}
}
The PostHog example shows the all-in-one pattern: the same SDK handles analytics, identity, and feature flags.
Mixpanel
// lib/mixpanel.ts
import mixpanel from 'mixpanel-browser';
mixpanel.init(process.env.NEXT_PUBLIC_MIXPANEL_TOKEN!, {
track_pageview: true,
persistence: 'localStorage',
ignore_dnt: false,
});
export { mixpanel };
// Usage
import { mixpanel } from '@/lib/mixpanel';
async function handleSubscriptionSuccess(plan: string, userId: string) {
// Identify
mixpanel.identify(userId);
mixpanel.people.set({
$email: user.email,
$name: user.name,
plan,
subscribed_at: new Date().toISOString(),
});
// Track
mixpanel.track('Subscription Started', {
plan,
source: 'checkout',
mrr: getPlanMRR(plan),
});
}
Mixpanel's SDK is clean and focused. No feature flag integration — you'd need LaunchDarkly or similar alongside.
Heap
<!-- In your _document.tsx or layout.tsx -->
<script
type="text/javascript"
dangerouslySetInnerHTML={{
__html: `window.heap=window.heap||[...]; heap.load("${process.env.NEXT_PUBLIC_HEAP_APP_ID}");`,
}}
/>
// Usage — Heap captures most events automatically
// You only need to explicitly track custom events and identify users
declare global {
interface Window {
heap: {
identify: (identity: string) => void;
addUserProperties: (properties: Record<string, unknown>) => void;
track: (event: string, properties?: Record<string, unknown>) => void;
};
}
}
async function handleSubscriptionSuccess(plan: string, userId: string) {
// Identify
window.heap.identify(userId);
window.heap.addUserProperties({
email: user.email,
name: user.name,
plan,
});
// Track custom event (Heap captures button clicks automatically,
// but explicit tracking is useful for backend-triggered events)
window.heap.track('Subscription Started', {
plan,
source: 'checkout',
mrr: getPlanMRR(plan),
});
}
With Heap, the button click that triggered this function was likely already captured automatically. The explicit heap.track() call is valuable for server-side events or events with richer business context.
SDK Size and Performance Impact
Analytics SDKs run on every page load, making bundle size and runtime performance meaningful concerns.
PostHog JS SDK
PostHog's JavaScript SDK is approximately 34KB gzipped. It's a full-featured SDK that includes:
- Event capture and queuing
- Feature flag evaluation (local and remote)
- Session replay recording
- Web analytics
- Survey rendering
The size reflects the breadth. For teams using PostHog as their all-in-one platform, this is one SDK replacing several (Mixpanel + LaunchDarkly + FullStory would collectively be larger). PostHog also supports loading from a custom proxy to avoid ad-blockers.
You can reduce the bundle by only loading the modules you need:
import posthog from 'posthog-js';
posthog.init(key, {
disable_session_recording: true, // Don't load recording code
autocapture: false, // Don't load autocapture
loaded: (ph) => {
if (process.env.NODE_ENV === 'development') ph.opt_out_capturing();
},
});
Mixpanel JS SDK
Mixpanel's SDK is approximately 28KB gzipped — lighter than PostHog, reflecting the narrower feature set. It covers event tracking, user identification, and profile updates. Session replay and heatmaps (added in 2025) load as a separate chunk.
Mixpanel offers a "lite" SDK that strips some less-used features and runs at about 16KB gzipped. For applications where every kilobyte counts, this is meaningful.
Heap JS SDK
Heap's snippet loads a small bootstrapper (~3KB inline) that asynchronously loads the full SDK. The full SDK runs at approximately 18KB gzipped. However, Heap's autocapture means the SDK is actively listening for every DOM event: clicks, form submissions, page changes. There's a small but non-zero runtime cost for this continuous instrumentation.
The tradeoff is explicit: Heap adds more JavaScript execution overhead but removes the developer burden of instrumenting events. For most applications, this overhead is imperceptible, but for performance-critical pages (landing pages, checkout flows), teams sometimes disable Heap's autocapture and use explicit tracking instead.
API Quality and Data Export
PostHog API
PostHog exposes both a REST API and a GraphQL-style Query API. The Query API is particularly useful for custom data extraction:
// PostHog Query API — run HogQL (PostHog's SQL dialect)
const response = await fetch('https://app.posthog.com/api/query/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${POSTHOG_PERSONAL_API_KEY}`,
},
body: JSON.stringify({
query: {
kind: 'HogQLQuery',
query: `
SELECT
person_id,
count() as event_count,
max(timestamp) as last_seen
FROM events
WHERE event = 'subscription_started'
AND timestamp >= '2026-01-01'
GROUP BY person_id
ORDER BY event_count DESC
LIMIT 100
`,
},
}),
});
HogQL is PostHog's ClickHouse-backed SQL dialect. For teams comfortable with SQL, it's a powerful way to extract custom insights that the UI can't provide. PostHog also supports direct warehouse export to BigQuery, S3, and Snowflake on paid plans.
Mixpanel API
Mixpanel exposes a Data Export API and a Query API. The Data Export API lets you export raw event data to your own systems. The JQL (JavaScript Query Language) API is Mixpanel's answer to ad-hoc analysis:
// Mixpanel JQL — JavaScript-based query language
function main() {
return Events({
from_date: '2026-01-01',
to_date: '2026-03-18',
event_selectors: [{ event: 'Subscription Started' }],
})
.groupBy(['properties.plan'], mixpanel.reducer.count())
.sortDesc('value')
.limit(10);
}
Mixpanel's export capabilities are solid for business intelligence use cases. They also offer a Warehouse Connector for BigQuery and Snowflake on Enterprise plans.
Heap API
Heap's API is more limited than PostHog's or Mixpanel's for custom querying. The primary data access path is through the Heap UI or through a data export to your warehouse. Heap Connect exports all autocaptured events to Redshift, BigQuery, or Snowflake — giving you full SQL access to your raw Heap data.
For teams with a data warehouse, Heap's warehouse export is excellent. For teams who want to run ad-hoc queries against their analytics data from their application, PostHog's HogQL or Mixpanel's JQL are more accessible.
Feature Flag Integration
Feature flags deserve special attention because they're closely coupled to analytics — you need to know which variant users saw when analyzing conversion data.
PostHog Feature Flags
PostHog's feature flags are native, not a bolt-on. Flags are evaluated in the same SDK as your analytics, which means zero cross-platform synchronization issues:
// Evaluate a flag and automatically track the exposure
const showNewCheckout = posthog.isFeatureEnabled('new-checkout-flow');
// PostHog automatically creates a feature_flag_called event
// linking the user to the variant for funnel analysis
When you run an A/B test in PostHog, the experiment results are automatically linked to your conversion events because everything lives in the same data model. You don't need to manually add "which experiment variant did this user see?" as a property on every downstream event.
Mixpanel + LaunchDarkly (External Flags)
Mixpanel doesn't have native feature flags. Teams using Mixpanel for analytics typically use LaunchDarkly or Statsig for feature flags and then manually log flag exposure as a Mixpanel event:
import { LDClient } from 'launchdarkly-node-server-sdk';
import mixpanel from 'mixpanel-browser';
const flagValue = await ldClient.variation('new-checkout-flow', user, false);
// Manual instrumentation required
mixpanel.track('Feature Flag Evaluated', {
flag: 'new-checkout-flow',
variant: flagValue,
userId: user.key,
});
This works but requires discipline. If engineers forget to log the flag exposure, your experiment analysis is incomplete. The PostHog approach is less error-prone because the exposure is captured automatically.
Heap + Flags
Heap has no native feature flags. Same pattern as Mixpanel — you integrate an external flag provider and manually track exposures as Heap events. Heap's autocapture will capture UI interactions without additional code, but flag exposure events require explicit tracking.
Self-Hosting PostHog
The self-host path is real but demanding. PostHog's open-source version runs on:
- PostgreSQL (user data, feature flags, configuration)
- ClickHouse (analytics events — the heavy storage layer)
- Redis (caching, session data)
- Kafka (event ingestion pipeline)
The recommended approach for up to 100K events/month is the docker-compose deployment on a single machine. For production at 1M+ events/month, you need Kubernetes or a managed deployment.
Infrastructure cost estimates from the community:
- 100K events/month: $50-100/month (single VPS)
- 1M events/month: $880-$1,100/month (PostgreSQL + ClickHouse VMs)
- 10M events/month: $3,500-$5,000/month
Break-even vs. PostHog Cloud: roughly 2-3M events/month where the infrastructure cost equals PostHog Cloud pricing plus operational overhead. For most startups, the Cloud free tier and low-cost paid tier makes self-hosting a pre-mature optimization.
Which Platform Fits Your Team?
Choose PostHog if you're an engineering-led team that wants one SDK for analytics, session replay, feature flags, experiments, and error tracking. The open-source option is real. The free tier is generous. For teams building AI features, the LLM analytics launched in 2026 is unique. The tradeoff: the product is broad, and some features are less polished than specialized tools.
Choose Mixpanel if funnel analysis and behavioral cohorts are the core of your product analytics practice, and you don't need feature flags or error tracking from the same tool. The free tier at 1M events/month makes it accessible, and the analytics UI is still best-in-class for non-technical PMs. The tradeoff: no self-hosting, and adding session replay/feature flags means separate tools.
Choose Heap if you have a non-technical product team that wants to analyze user behavior without engineering involvement in every tracking decision, or if retroactive analysis of historical interactions is critical to your workflow. The autocapture philosophy genuinely changes how product teams can work. The tradeoff: enterprise pricing, opaque cost structure, and no self-hosting.
A common migration path in 2026: teams start with PostHog for the breadth and free tier, then some add Mixpanel for stakeholder-facing funnel reports because Mixpanel's shareable dashboards are more polished for non-technical audiences. The PostHog + Mixpanel stack adds cost but covers the full spectrum of analytics use cases.
See also: PostHog vs Mixpanel API 2026, How to Add Product Analytics with PostHog, Building a SaaS Backend with Auth, Stripe, PostHog, and Resend