Back to Blog

Product Analytics: PostHog vs Mixpanel vs Amplitude, Funnel Analysis, and A/B Testing

Choose and implement product analytics — PostHog vs Mixpanel vs Amplitude comparison, event tracking schema design, funnel analysis, cohort retention, and A/B t

Viprasol Tech Team
May 11, 2026
12 min read

Product Analytics: PostHog vs Mixpanel vs Amplitude, Funnel Analysis, and A/B Testing

Product analytics answers the questions that database queries can't easily answer: Why are users dropping off at step 3 of onboarding? Which features are correlated with long-term retention? Does version B of the checkout flow convert better than version A?

Choosing the right tool and setting up a clean event schema are the two decisions that determine whether your analytics investment pays off.


Tool Comparison (2026)

ToolPricingSelf-HostBest ForWeakness
PostHogFree (1M events/mo) + $0.0003/event✅ YesStartups, open-source, engineersLess polished than Mixpanel for non-technical users
MixpanelFree (20M events/mo) + usage-based❌ NoGrowth teams, marketing-ledExpensive at scale, no session recording
AmplitudeFree (10M events/mo) + $995+/mo❌ NoEnterprise, data-mature orgsComplex, steep learning curve
June$49–599/mo❌ NoB2B SaaS metrics specificallyLimited custom analysis
Heap$3,500+/year❌ NoRetroactive capture (no pre-planning)Expensive, data volume issues
Plausible$9–19/mo✅ YesPrivacy-first, simple web analyticsNot suitable for product analytics

For most SaaS startups: PostHog (self-hosted or cloud). It covers analytics, session recording, feature flags, and A/B testing in one platform — and the free tier handles most early-stage needs.


Event Schema Design

The most important analytics decision you'll make. A good schema is easy to query; a bad one creates a mountain of data that can't answer your questions.

Naming conventions:

Object-Action format: noun_verb (past tense)
  ✅ project_created
  ✅ member_invited  
  ✅ subscription_upgraded
  ✅ payment_failed
  
  ❌ create_project (imperative)
  ❌ ProjectCreated (PascalCase)
  ❌ project-created (hyphens — hard to query)

Properties standard:

// Every event should include these standard properties
interface BaseEventProperties {
  // User context
  userId: string;
  anonymousId?: string;  // Pre-login
  tenantId?: string;     // For B2B
  userPlan: 'free' | 'starter' | 'pro' | 'enterprise';

  // Session context
  sessionId: string;
  pageUrl: string;
  referrer?: string;

  // App context
  appVersion: string;
  platform: 'web' | 'ios' | 'android' | 'api';
}

Domain event schema:

// Define all events with their specific properties
const events = {
  project_created: {
    projectId: string;
    projectName: string;
    templateUsed?: string;
    memberCount: number;
    source: 'onboarding' | 'dashboard' | 'api';
  },

  member_invited: {
    projectId: string;
    inviteeEmail: string;  // Hashed before sending to analytics
    inviteeRole: 'admin' | 'editor' | 'viewer';
    inviteMethod: 'email' | 'link' | 'bulk_import';
  },

  feature_used: {
    featureName: string;
    featureCategory: string;
    // Avoid one "feature_used" event per feature —
    // creates hundreds of similar events.
    // Use this only for genuinely cross-cutting features.
  },

  subscription_upgraded: {
    previousPlan: string;
    newPlan: string;
    billingCycle: 'monthly' | 'annual';
    upgradeSource: 'paywall' | 'settings' | 'admin' | 'api';
    mrr_change_cents: number;
  },
};

🚀 SaaS MVP in 8 Weeks — Seriously

We have launched 50+ SaaS platforms. Multi-tenant architecture, Stripe billing, auth, role-based access, and cloud deployment — all handled by one senior team.

  • Week 1–2: Architecture design + wireframes
  • Week 3–6: Core features built + tested
  • Week 7–8: Launch-ready on AWS/Vercel with CI/CD
  • Post-launch: Maintenance plans from month 3

PostHog Implementation

// lib/analytics.ts
import posthog from 'posthog-js';

// Initialize (client-side)
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
  api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST ?? 'https://app.posthog.com',
  loaded: (ph) => {
    if (process.env.NODE_ENV === 'development') ph.opt_out_capturing();
  },
  capture_pageview: false,  // Handle manually for SPA
  persistence: 'localStorage',
  autocapture: false,  // Be intentional about what you track
});

// Wrapper with TypeScript types
type EventName = keyof typeof events;

export function trackEvent<T extends EventName>(
  name: T,
  properties: typeof events[T] & Partial<BaseEventProperties>
): void {
  posthog.capture(name, {
    ...properties,
    appVersion: process.env.NEXT_PUBLIC_APP_VERSION,
  });
}

// Identify user (call on login and on page load if authenticated)
export function identifyUser(user: {
  id: string;
  email: string;
  name: string;
  plan: string;
  tenantId: string;
  createdAt: string;
}): void {
  posthog.identify(user.id, {
    email: user.email,
    name: user.name,
    plan: user.plan,
    tenantId: user.tenantId,
    createdAt: user.createdAt,
  });
}

// Server-side tracking (for backend events)
import { PostHog } from 'posthog-node';

const serverAnalytics = new PostHog(process.env.POSTHOG_KEY!, {
  host: process.env.POSTHOG_HOST ?? 'https://app.posthog.com',
  flushAt: 20,
  flushInterval: 10000,
});

export async function trackServerEvent(
  userId: string,
  name: string,
  properties: Record<string, unknown>
): Promise<void> {
  serverAnalytics.capture({
    distinctId: userId,
    event: name,
    properties: {
      ...properties,
      $lib: 'posthog-node',
      appVersion: process.env.APP_VERSION,
    },
  });
}

Funnel Analysis

A funnel tracks how many users progress through a sequence of steps:

Signup funnel:
  signup_started     → 10,000 users
  email_verified     → 7,200 (72%)
  profile_completed  → 5,100 (51%)
  first_project_created → 2,800 (28%)  ← big drop-off here
  member_invited     → 1,400 (14%)
  activated          → 1,200 (12%)

Build funnels in PostHog:

  1. Create Funnel insight
  2. Add steps in order: signup_startedemail_verifiedproject_createdmember_invited
  3. Set conversion window: 14 days (trial period)
  4. Break down by property: userPlan, platform, country

The insight: A 72% email verification rate with only 28% project creation means the drop-off is between verification and first use — not at the top of the funnel. Focus onboarding improvements there.


💡 The Difference Between a SaaS Demo and a SaaS Business

Anyone can build a demo. We build SaaS products that handle real load, real users, and real payments — with architecture that does not need to be rewritten at 1,000 users.

  • Multi-tenant PostgreSQL with row-level security
  • Stripe subscriptions, usage billing, annual plans
  • SOC2-ready infrastructure from day one
  • We own zero equity — you own everything

Cohort Retention Analysis

Retention cohorts show what % of users who signed up in a given week are still active N weeks later:

-- Build retention cohort in PostgreSQL for custom analysis
WITH cohorts AS (
    SELECT
        DATE_TRUNC('week', MIN(created_at)) AS cohort_week,
        user_id
    FROM events
    WHERE event_type = 'user_signed_up'
    GROUP BY user_id
),
activity AS (
    SELECT DISTINCT
        c.user_id,
        c.cohort_week,
        DATE_TRUNC('week', e.created_at) AS activity_week,
        EXTRACT(EPOCH FROM (
            DATE_TRUNC('week', e.created_at) - c.cohort_week
        )) / 604800 AS weeks_since_signup  -- 604800 seconds in a week
    FROM cohorts c
    JOIN events e ON e.user_id = c.user_id
    WHERE e.event_type NOT IN ('page_viewed')  -- Exclude passive events
)
SELECT
    cohort_week,
    COUNT(DISTINCT user_id) AS cohort_size,
    COUNT(DISTINCT CASE WHEN weeks_since_signup = 1 THEN user_id END) AS week_1,
    COUNT(DISTINCT CASE WHEN weeks_since_signup = 2 THEN user_id END) AS week_2,
    COUNT(DISTINCT CASE WHEN weeks_since_signup = 4 THEN user_id END) AS week_4,
    COUNT(DISTINCT CASE WHEN weeks_since_signup = 8 THEN user_id END) AS week_8,
    COUNT(DISTINCT CASE WHEN weeks_since_signup = 12 THEN user_id END) AS week_12
FROM activity
WHERE cohort_week >= NOW() - INTERVAL '90 days'
GROUP BY cohort_week
ORDER BY cohort_week;

Industry benchmarks (B2B SaaS):

  • Week 1 retention: 70–85% (good)
  • Week 4 retention: 40–60% (good)
  • Week 12 retention: 25–45% (good)
  • D30 < 20%: churn problem — investigate

A/B Testing with Feature Flags

// PostHog feature flags for A/B testing
import { useFeatureFlagVariantKey } from 'posthog-js/react';

function PricingPage() {
  // Assigns user to variant — consistent across sessions
  const variant = useFeatureFlagVariantKey('pricing-page-test');

  return (
    <div>
      {variant === 'annual-default' ? (
        <PricingToggle defaultBilling="annual" />
      ) : (
        <PricingToggle defaultBilling="monthly" />
      )}
    </div>
  );
}

// Track the outcome event
function handleUpgrade(plan: string, billing: string) {
  trackEvent('subscription_upgraded', {
    newPlan: plan,
    billingCycle: billing as 'monthly' | 'annual',
    upgradeSource: 'pricing_page',
    mrr_change_cents: calculateMRR(plan, billing),
    // PostHog automatically associates this with the feature flag variant
  });
}

A/B test decision criteria:

  • Minimum sample: 1,000+ users per variant before declaring results
  • Statistical significance: p < 0.05 (PostHog calculates this)
  • Practical significance: effect size matters (1% conversion lift may not be worth shipping complexity)
  • Run for at least 2 weeks to capture weekly variation

Working With Viprasol

We set up product analytics infrastructure for SaaS products — event schema design, PostHog or Mixpanel implementation, funnel and retention dashboards, A/B testing frameworks, and data pipelines to your warehouse. Analytics infrastructure built correctly pays dividends in every future product decision.

Talk to our team about product analytics implementation.


See Also

Share this article:

About the Author

V

Viprasol Tech Team

Custom Software Development Specialists

The Viprasol Tech team specialises in algorithmic trading software, AI agent systems, and SaaS development. With 100+ projects delivered across MT4/MT5 EAs, fintech platforms, and production AI systems, the team brings deep technical experience to every engagement. Based in India, serving clients globally.

MT4/MT5 EA DevelopmentAI Agent SystemsSaaS DevelopmentAlgorithmic Trading

Building a SaaS Product?

We've helped launch 50+ SaaS platforms. Let's build yours — fast.

Free consultation • No commitment • Response within 24 hours

Viprasol · AI Agent Systems

Add AI automation to your SaaS product?

Viprasol builds custom AI agent crews that plug into any SaaS workflow — automating repetitive tasks, qualifying leads, and responding across every channel your customers use.