Build a Startup Cheatsheet

Analytics and Monitoring

Use this Build a Startup reference while you build software engineering projects, review code for technical interview prep, or polish examples for a software engineer resume.

Why Analytics Matter From Day One

You cannot improve what you cannot measure. Analytics answers the questions that drive product decisions:

  • Where are users dropping off in the sign-up flow?
  • Which features are being used — and which are being ignored?
  • How long do users take to reach their first "aha moment"?
  • Is page load time hurting conversion on mobile?
  • When did error rates spike?

Add analytics on your first day of users. Retrofitting it later means making decisions with no data for weeks or months.

The Two Types of Analytics

Product analytics — tracks user behavior in your product: page views, clicks, form submissions, feature usage, funnel conversion rates, retention.

Monitoring / observability — tracks your system's health: errors, latency, uptime, database performance, failed API calls. This is what wakes you up at 3 a.m. when something breaks.

Both are essential. They serve different audiences: product analytics for founders and product teams; monitoring for engineers.

Product Analytics Tools

PostHog

PostHog is an open-source, all-in-one product analytics platform: event tracking, funnels, session recording, feature flags, A/B testing, and a heatmap — all in one tool.

Free tier: 1 million events/month, 15,000 session recordings, 1 million feature flag calls.

Pricing: Pay-as-you-go after the free tier; scales with events.

Why PostHog for startups: - Extremely generous free tier — most early-stage products never pay - Self-hostable if you have data privacy requirements - Feature flags built in — deploy features to 10% of users without code changes - Session replay: watch exactly what users did (replays user's screen, clicks, keypresses) - Cohort analysis and retention charts out of the box - One SDK for events, feature flags, and A/B tests

npm install posthog-js
// Initialize once in your app
import posthog from "posthog-js";
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY!, {
  api_host: "https://us.i.posthog.com",
});

// Identify a logged-in user
posthog.identify(user.id, { email: user.email, plan: user.plan });

// Track a custom event
posthog.capture("resume_generated", { template: "compact", aiTokensUsed: 1200 });

Google Analytics 4 (GA4)

Google Analytics 4 is free and provides detailed traffic analytics, user demographics, device breakdowns, and conversion tracking. It is the standard for marketing and SEO analytics.

Free tier: Unlimited (with data retention limits — 14 months for free).

Pros: - Free forever at any scale - Integrates with Google Ads, Search Console, Looker Studio - Great for tracking traffic sources, SEO, ad performance - No setup cost; paste a script tag to start

Cons: - Data is shared with Google; privacy implications - Not designed for product behavior analytics (funnels, retention, user-level tracking are weaker than PostHog) - Cookie consent requirements in the EU (GDPR) - UI can be confusing; reports are not always intuitive

When to use GA4: You want to understand where your traffic comes from, which marketing channels convert, and what your SEO metrics look like.

When to use PostHog instead: You want to understand what users do inside your product.

Recommendation: Both. GA4 is free and handles marketing analytics. PostHog handles in-product behavior.

Mixpanel

Mixpanel is a product analytics tool focused on events and funnels. Strong for B2C consumer apps.

Free tier: 20 million events/month.

Pros: - Very powerful funnel and retention analysis - User-level event history ("show me everything this specific user did") - A/B testing and experimentation

Cons: - More expensive than PostHog at scale - No session recording - No built-in feature flags

When to use: Consumer apps at scale where you need deep funnel analysis and user-level behavior history.

Amplitude

Amplitude is a full product analytics suite — similar to Mixpanel but positioned for larger teams.

Free tier: Starter plan is free (1 million tracked users/month).

When to use: Mid-to-large teams that need advanced behavioral analytics, predictive models, and deep segmentation.

Monitoring and Observability

Error Tracking: Sentry

Sentry captures every unhandled error in your frontend and backend, with full stack traces, user context, and breadcrumbs (what the user did before the error).

Free tier: 5,000 errors/month, 1 performance unit.

Pricing: $26/month (Team) for higher volumes.

Why Sentry is mandatory: - You will not see errors in production unless you track them — users rarely report bugs - Stack traces with line numbers make debugging fast - Can alert you via Slack/email when a new error appears

npm install @sentry/nextjs
npx @sentry/wizard@latest -i nextjs
// Capture an error manually
import * as Sentry from "@sentry/nextjs";

try {
  await dangerousOperation();
} catch (error) {
  Sentry.captureException(error, { extra: { userId, context: "payment processing" } });
  throw error;
}

Uptime Monitoring

Know when your site is down — before your users tell you.

ToolFree tierCheck intervalNotes
Better Uptime10 monitors, 3 min3 minutesClean UI; status pages included
UptimeRobot50 monitors5 minutesLong-standing; generous free tier
ChecklySynthetic monitoring10 minAPI and browser checks; good for complex flows
Vercel AnalyticsIncludedReal-timeBasic; Vercel-hosted apps only

Set up at least one uptime monitor on day one. You want a Slack or email notification if your production site goes down.

Logging

Logs are the text trail of everything your server does. Essential for debugging production issues.

ToolFree tierBest for
Axiom500 GB/monthNext.js, Vercel; excellent DX; free tier very generous
Logtail (Better Stack)1 GB/monthSimple, clean log search
Datadog14-day retention (trial)Enterprise; full observability stack
Railway / Render logsIncludedBasic log tailing within their dashboards

For early-stage startups: Axiom's free tier is generous enough that you may never pay. Install the Next.js integration to send all server logs automatically.

Performance Monitoring

Vercel Analytics + Web Vitals — if you deploy on Vercel, it gives you Core Web Vitals (LCP, CLS, FID) per page automatically.

Sentry Performance — trace slow database queries, API calls, and rendering bottlenecks. Part of the Sentry SDK.

Lighthouse — Google's browser tool (also available via CLI) for auditing page performance, accessibility, SEO, and best practices.

npx lighthouse https://yourapp.com --view

Analytics Stack by Stage

StageRecommended toolsMonthly cost
Pre-launchGA4 + PostHog free + Sentry free$0
Early users (0–1K)GA4 + PostHog free + Sentry free + UptimeRobot$0
Growing (1K–10K users)GA4 + PostHog free + Sentry Team + Axiom~$26/month
Scaling (10K+ users)GA4 + PostHog or Mixpanel + Sentry + Datadog$100–$300/month

Key Metrics to Track From Day One

Acquisition: - Traffic sources (GA4) - Landing page conversion rate (visitors → sign-ups) - Cost per acquisition if running ads

Activation: - Time from sign-up to first meaningful action - % of users who complete onboarding

Retention: - Day 1, Day 7, Day 30 retention (% of users who return) - Churn rate (subscriptions canceled / active subscriptions)

Revenue: - Monthly Recurring Revenue (MRR) - Average Revenue Per User (ARPU) - Trial-to-paid conversion rate

Referral: - Viral coefficient (do users tell others?) - NPS score (via a simple in-app survey)

Technical health: - Error rate (Sentry) - P99 API latency - Uptime percentage

Track fewer metrics deeply rather than many metrics shallowly. Pick 3–5 metrics that directly indicate whether your product is working and focus on those.