Blog | How to Add Analytics to Your AI-Built App (GA4, Plausible, Mixpanel) | 09 Jun, 2026
How to Add Analytics to Your AI-Built App (GA4, Plausible, Mixpanel)

Your AI-built app needs analytics to understand who uses it and how. The four main options for indie SaaS: GA4 (free, ubiquitous, privacy-tricky), Plausible (privacy-first, simple, paid), Mixpanel (product analytics for SaaS, generous free tier), PostHog (everything-in-one, self-host or cloud). Pick based on whether you need site analytics, product analytics, or both, and how privacy-sensitive your user base is. This guide covers installation walkthroughs for each, what events to track for SaaS specifically, and the realistic stack for a $0–$10K MRR indie SaaS.
Your AI-built app shipped. Users are signing up. Now what? Without analytics, you're flying blind — no idea where users come from, what they do, what they get stuck on, what makes them come back. Analytics turns a static app into a feedback loop. For indie SaaS specifically, the right analytics setup is the difference between guessing and knowing where to focus product effort.
Three Categories of Analytics
Site Analytics (Page Views, Traffic Sources, Basic Engagement)
- Who visits your marketing pages
- Where they come from (search, social, direct, referral)
- Which pages they view
- How long they stay; bounce rates
- Tools: GA4, Plausible, Fathom, Simple Analytics
Product Analytics (In-App Behavior, Funnels, Retention)
- Who signs up; conversion from visitor to signup
- What features users use after signup
- Activation funnel (signup → key action → retention)
- Retention cohorts (Day 1, Day 7, Day 30)
- Feature usage by segment
- Tools: Mixpanel, Amplitude, PostHog, June
Session Replay and Qualitative Analytics
- Watch users navigate your app
- Heatmaps of where they click
- Identifying UX friction qualitatively
- Tools: PostHog, FullStory, Hotjar, LogRocket
Compared at a Glance
| Tool | Best For | Pricing | Strengths | Limits |
|---|
| GA4 | Site analytics, free baseline | Free | Free, ubiquitous, marketing integrations | Complex UI, privacy concerns, not built for SaaS product analytics |
| Plausible | Privacy-first site analytics | $9–$69/month | Privacy-compliant, simple, fast | Limited event tracking, no funnels/cohorts |
| Mixpanel | SaaS product analytics | Free → $24/month → enterprise | Funnels, cohorts, retention built-in | Free tier event limits; UI complex |
| PostHog | All-in-one (product, replay, flags) | Free (1M events) → usage-based | Everything in one tool; self-host option | Can be overwhelming; usage costs scale |
What to Install: The Minimal Indie SaaS Stack
- $0–$1K MRR: Plausible OR GA4 (site analytics) + PostHog free tier (product analytics + replay)
- $1K–$10K MRR: Same stack OR upgrade to Mixpanel free tier
- $10K–$100K MRR: PostHog paid OR Mixpanel paid; consider session replay separately if budget allows
- $100K+ MRR: Evaluate enterprise tooling (Amplitude, custom)
Realistic answer for most indie SaaS at any stage: PostHog free tier + Plausible. PostHog handles product analytics, session replay, feature flags, A/B testing — all in one. Plausible handles the marketing site cleanly with privacy compliance. Total cost: $0–$10/month at indie scale.
Installing GA4 (Free)
What It Does Well
- Free with generous limits
- Ubiquitous — almost every other tool integrates with GA4
- Marketing channel attribution
- Google Ads integration if you advertise
Installation in Next.js
Use @next/third-parties package. Add to your root layout: import GoogleAnalytics from '@next/third-parties/google'; include the component with your measurement ID (G-XXXXXXXXXX). That's it. Default page view tracking works automatically. Custom events require additional gtag calls.
Privacy Considerations
- GA4 collects IP addresses (anonymized but still concerning in some jurisdictions)
- EU GDPR compliance requires cookie consent banner
- Some jurisdictions (Austria, France, Italy) have ruled GA4 illegal in specific contexts
- If you have many EU users, consider Plausible instead or add proper consent management
Installing Plausible (Privacy-First)
What It Does Well
- Privacy-first — no cookies, no personal data collection
- GDPR-compliant by default
- Simple dashboard, fast to read
- Real-time visitor count
- Goal tracking for key conversions
Installation in Next.js
Add the Plausible script to your root layout with data-domain attribute set to your domain. That's the entire install. Default page view tracking works. Custom events use the plausible() function call. Plausible's documentation has copy-paste snippets for Next.js, React, and vanilla HTML.
Pricing
- $9/month for 10K pageviews
- $19/month for 100K pageviews
- $69/month for 1M pageviews
- 30-day free trial
- Self-host option available (Docker setup) for $0/month after infrastructure
Installing Mixpanel (SaaS Product Analytics)
What It Does Well
- Built specifically for SaaS product analytics
- Funnels (signup → activation → retention)
- Cohort analysis
- User profiles and segmentation
- Generous free tier (100M events/month)
Installation in Next.js
npm install mixpanel-browser. Initialize in a client component with your project token. Track events via mixpanel.track('Event Name', properties). Identify users on signup via mixpanel.identify(userId). Set user properties via mixpanel.people.set. Add a wrapper hook (useAnalytics) to make tracking ergonomic throughout your app.
Installing PostHog (All-in-One)
What It Does Well
- Product analytics + session replay + feature flags + A/B testing + surveys + data warehouse
- Self-host option for complete data ownership
- Free tier generous (1M events/month, 5K replays)
- Active product development with rapid feature releases
- Open source
Installation in Next.js
npm install posthog-js posthog-node. Wrap your app with PostHogProvider in your root layout. Initialize with your project API key and host URL. PostHog automatically captures page views, clicks, and form interactions. Custom events via posthog.capture('event name', properties). User identification via posthog.identify(userId, properties).
Pricing
- Free: 1M product analytics events/month, 5K session replays/month, 1M feature flag requests
- Paid: usage-based after free tier
- Self-host: $0 hosting cost (you pay infrastructure)
- Costs can scale significantly at high volume; monitor usage
What Events to Track for SaaS
Acquisition Events
- Landing page view (with UTM parameters)
- Signup form viewed
- Signup completed
- Email verified (if applicable)
Activation Events (Most Important)
- First key action completed (varies by SaaS — depends on your product)
- Onboarding step completed (each step)
- First useful output generated/saved
- Connected an external account (if relevant)
- Invited a teammate (if collaborative)
Engagement and Monetization Events
- Daily/weekly login
- Specific feature used (each major feature)
- Content created/saved
- Pricing page viewed
- Plan upgrade clicked
- Subscription started
- Subscription canceled
User Properties to Set
- Plan (free, pro, enterprise)
- Signup date
- Last active date
- Total events count (proxy for engagement)
- Company name (if B2B)
- Acquisition source (organic, paid, referral)
- User role (admin, member)
Common Mistakes Adding Analytics
- Tracking too many events — More events = more noise. Pick 10–20 key events; don't track every click.
- Tracking before defining what you measure — Decide what questions you want answered before setting up tracking.
- Not setting user properties — Properties enable segmentation. Without them, you can't compare free vs paid users.
- Tracking on both client and server inconsistently — Pick a primary side; document the convention.
- Skipping UTM parameter capture — Without UTMs, attribution is broken. Capture and store UTMs at signup.
- Forgetting cookie consent in EU — Required by law. Set up consent management before launching to EU users.
- Setting up multiple analytics tools without unified strategy — Duplicate work, conflicting data.
- Not testing tracking after install — Use the tool's debug mode to verify events fire correctly.
- Ignoring data quality early — Bad data accumulates. Audit event quality quarterly.
- Treating analytics as separate from product work — Analytics informs product decisions. Build it into your workflow.
Cookie Consent and Privacy Compliance
- EU/UK users: GDPR requires consent before non-essential cookies
- California users: CCPA requires opt-out mechanism for data sale
- Use a consent management platform (Cookiebot, Iubenda, or build simple one)
- GA4: requires consent in EU/UK
- Plausible: no cookies; no consent needed
- Mixpanel and PostHog: configurable; can use cookieless mode
Building Analytics Dashboards for Your Team
- Don't make team members hunt through tools — Build a weekly Slack/email digest
- PostHog has dashboard sharing built in
- Mixpanel has dashboards and scheduled reports
- GA4 has Looker Studio integration for custom dashboards
- Custom dashboards work too — pull from APIs, send to Slack weekly
Frequently Asked Questions
Should I install all four tools?
No. Tracking the same events in four tools wastes setup time and creates conflicting data. Pick one site analytics (Plausible or GA4) and one product analytics (PostHog or Mixpanel). For most indie SaaS: Plausible + PostHog is the realistic answer.
How long does analytics setup take?
Initial install: 1–2 hours. Defining event schema: 2–4 hours. Building first dashboards: 2–4 hours. Total: 1 day to have meaningful tracking. Don't over-invest upfront; iterate as questions arise.
What's the most important event to track for SaaS?
Activation event — the moment a user reaches the 'aha' for your product. Varies by product. For email tools, sending first email. For analytics tools, viewing first dashboard. Without this event tracked, you can't measure activation rate or improve onboarding.
Can I track without cookies?
Yes. Plausible is cookieless by default. PostHog and GA4 have cookieless modes. Some functionality (cross-session user tracking) requires identification via user ID after login. Cookieless modes work well for site analytics; product analytics typically requires user identification post-login.
How often should I look at analytics?
Daily for active product iteration. Weekly review for trends. Monthly cohort analysis. Don't check obsessively; data variance over short periods isn't informative. Build dashboards that summarize what matters; check them at intervals.
Four main analytics options for indie SaaS in 2026: GA4 (free, ubiquitous), Plausible (privacy-first, simple), Mixpanel (SaaS product analytics, generous free tier), PostHog (all-in-one with replay and flags). Most indie SaaS: PostHog free tier + Plausible. Total cost $0–$10/month at indie scale. Track the right events: activation events (most important), engagement, monetization, retention. Don't over-track; 10–20 key events is enough. Your AI-built app needs analytics to inform product decisions. Install the realistic stack this week: PostHog free tier + Plausible. Check it weekly; let trends inform what you ship next.