RORK LABJP
TOOLING — Rork's developer repos keep moving: rork-xcode was updated on July 16, rork-device on July 15, and rork-plist on July 13OPUS46 — Claude Opus 4.6 is live in Rork, and Rork Max is built to assemble apps on top of Claude CodeSIM — A cloud iOS simulator runs in the browser, with one click to install on a device and two clicks to publish to the App StoreMAX — Rork Max emits pure Swift rather than React Native, reaching iPhone, iPad, Apple Watch, Apple TV, Vision Pro, and even iMessageNATIVE — That opens up HealthKit, ARKit and LiDAR, NFC, Dynamic Island, Live Activities, 3D through Metal, and on-device inference with Core MLSEED — Rork raised a $15M seed led by Left Lane Capital, with Peak XV and a16z Speedrun joining the roundTOOLING — Rork's developer repos keep moving: rork-xcode was updated on July 16, rork-device on July 15, and rork-plist on July 13OPUS46 — Claude Opus 4.6 is live in Rork, and Rork Max is built to assemble apps on top of Claude CodeSIM — A cloud iOS simulator runs in the browser, with one click to install on a device and two clicks to publish to the App StoreMAX — Rork Max emits pure Swift rather than React Native, reaching iPhone, iPad, Apple Watch, Apple TV, Vision Pro, and even iMessageNATIVE — That opens up HealthKit, ARKit and LiDAR, NFC, Dynamic Island, Live Activities, 3D through Metal, and on-device inference with Core MLSEED — Rork raised a $15M seed led by Left Lane Capital, with Peak XV and a16z Speedrun joining the round
Articles/Dev Tools
Dev Tools/2026-04-04Intermediate

Rork × PostHog — Seeing What Users Actually Do Inside Your App

Learn how to integrate PostHog product analytics into your Rork app to understand user behavior. Step-by-step guide covering event tracking, funnels, feature flags, and user identification.

PostHog3product analyticsuser behaviorExpo149React Native209event trackingFunnel-Analysis

Why Your Rork App Needs Product Analytics

After shipping your app, it's natural to wonder: "Where are users dropping off?" or "Is anyone actually using that new feature?" App Store Connect gives you download numbers and revenue figures, but it won't tell you what users are doing inside your app.

That's the gap product analytics fills. PostHog is open source, drops into a Rork (React Native / Expo) project without much ceremony, and once events start flowing you get to watch a funnel break at a specific step instead of guessing which one. Feature flags ride along with it, so a risky screen can reach five percent of users before it reaches everyone.

What you'll learn:

  • What makes PostHog a strong choice for indie app developers
  • Installing and configuring the PostHog SDK in a Rork project
  • Tracking custom events and identifying users
  • Building funnels to find where users drop off
  • Using feature flags to release new features safely

What Is PostHog?

PostHog is an open-source product analytics platform that bundles everything a product team needs into a single tool. Unlike Mixpanel or Amplitude (which charge per event and lock features behind paid tiers), PostHog offers a generous free cloud tier and an optional self-hosted deployment.

Key capabilities include:

  • Event Analytics: Track any user action and visualize it with charts, graphs, and trend views
  • Funnel Analysis: Measure completion rates across multi-step flows like registration, onboarding, and checkout
  • Session Replay: Watch recordings of real user sessions to discover friction points (mobile support varies by platform)
  • Feature Flags: Ship features to specific user groups without a code deployment
  • A/B Testing: Compare variants and make data-driven decisions

The free cloud plan covers up to 1 million events per month — more than enough for most indie apps at launch. If data sovereignty matters to you, the self-hosted Docker option lets you keep everything on your own infrastructure.


Step 1: Create a PostHog Account and Get Your API Key

Head to PostHog Cloud and create a free account. After signing in, create a new project and note your Project API Key (it starts with phc_). You'll need this in the next step.

You can always find your API key under Settings → Project → Project API Key in the PostHog dashboard.


Step 2: Install the SDK

Inside your Rork project directory, run:

# Install the PostHog React Native SDK
npm install posthog-react-native
 
# If you're using Expo, install the required native modules
npx expo install expo-file-system expo-application expo-device expo-localization

Next, wrap your app with the PostHogProvider in your root layout file:

// app/_layout.tsx (Expo Router)
import { PostHogProvider } from 'posthog-react-native';
 
export default function RootLayout() {
  return (
    <PostHogProvider
      apiKey="YOUR_POSTHOG_API_KEY"  // Your phc_ project key
      options={{
        host: 'https://us.i.posthog.com',  // Use https://eu.i.posthog.com for EU
      }}
    >
      <Stack />
    </PostHogProvider>
  );
}

Tip: Store your API key in an .env file as EXPO_PUBLIC_POSTHOG_KEY rather than hardcoding it. PostHog public API keys (the phc_ ones) are client-side keys by design, but using environment variables keeps your codebase cleaner.


Step 3: Track Your First Events

With the provider in place, you can use the usePostHog hook in any component to send events to your dashboard.

// components/SubscribeButton.tsx
import { TouchableOpacity, Text } from 'react-native';
import { usePostHog } from 'posthog-react-native';
 
export function SubscribeButton() {
  const posthog = usePostHog();
 
  const handlePress = () => {
    // Capture an event with optional properties
    posthog.capture('subscribe_button_tapped', {
      screen: 'HomeScreen',
      plan: 'pro',
    });
 
    // Proceed with actual purchase logic
  };
 
  return (
    <TouchableOpacity onPress={handlePress}>
      <Text>Upgrade to Pro</Text>
    </TouchableOpacity>
  );
}

Keep event names in snake_case (e.g., subscribe_button_tapped) for consistency. You can attach any properties that will help you slice and filter data later — screen names, user plan types, session metadata, and so on.


Step 4: Identify Users After Sign-In

By default, events are recorded for anonymous users. Once a user signs in, call identify to link all previous and future events to their account.

// hooks/useAuth.ts
import { usePostHog } from 'posthog-react-native';
 
export function useAuth() {
  const posthog = usePostHog();
 
  const signIn = async (userId: string, email: string) => {
    // Your existing sign-in logic (Firebase Auth, Supabase, etc.)
    await performSignIn(userId);
 
    // Attach user info to PostHog
    posthog.identify(userId, {
      email: email,
      plan: 'free',
      created_at: new Date().toISOString(),
    });
  };
 
  const signOut = async () => {
    await performSignOut();
 
    // Reset the session on sign-out
    posthog.reset();
  };
 
  return { signIn, signOut };
}

After calling identify, PostHog merges the anonymous pre-login events with the identified user's profile. This gives you a complete, continuous view of each user's journey from first open through conversion.


Step 5: Build a Funnel to Find Drop-Off Points

Funnels are one of the most actionable reports in any analytics tool. They show you exactly which step in a multi-step flow causes the most drop-off.

To build a funnel, simply fire an event at each step:

// screens/Onboarding.tsx
const handleStep1Complete = () => {
  posthog.capture('onboarding_step1_completed'); // Profile setup done
  setStep(2);
};
 
const handleStep2Complete = () => {
  posthog.capture('onboarding_step2_completed'); // Notification preferences set
  setStep(3);
};
 
const handleOnboardingComplete = () => {
  posthog.capture('onboarding_completed');       // Full flow complete
  router.push('/home');
};

In the PostHog dashboard, navigate to Funnels, add these events in order, and PostHog will calculate the conversion rate at each step automatically. If you're seeing 80% of users complete Step 1 but only 40% reach Step 2, you know exactly where to focus your UX improvements.

For a deeper dive into improving user experience metrics hand-in-hand with analytics, check out the Rork App Performance Optimization Complete Guide — performance and user behavior are closely linked.


Step 6: Roll Out Features Safely with Feature Flags

Feature flags let you expose new functionality to a subset of your users without shipping a new app version. This is invaluable for testing risky UI changes or gradually rolling out a feature to avoid support overload.

// components/NewFeatureBanner.tsx
import { useFeatureFlagEnabled } from 'posthog-react-native';
 
export function NewFeatureBanner() {
  // Create a flag called 'new-dashboard-ui' in the PostHog dashboard
  const isEnabled = useFeatureFlagEnabled('new-dashboard-ui');
 
  if (!isEnabled) return null;
 
  return (
    <View>
      <Text>✨ Try our redesigned dashboard!</Text>
    </View>
  );
}

From the PostHog dashboard, you can configure the flag to roll out to 10% of users, target users with a specific property (e.g., plan = 'pro'), or enable it for your own account only for testing. When you're confident the new experience works well, simply flip the flag to 100%.


Looking back

Adding PostHog to your Rork app gives you the visibility to make informed product decisions rather than relying on guesswork. Here's a quick recap of what we covered:

  • PostHog is a free, open-source product analytics platform with event tracking, funnels, feature flags, and A/B testing all in one place
  • Installing posthog-react-native and wrapping your app with PostHogProvider takes just a few minutes
  • Use capture to record events and identify to tie them to specific users after sign-in
  • Funnel analysis helps you pinpoint exactly where users drop off in critical flows
  • Feature flags let you ship new functionality safely and gradually

Moving from gut-feel decisions to data-driven ones is one of the highest-leverage shifts an indie developer can make. Even a simple funnel showing onboarding completion rates can reveal improvements that dramatically impact retention and revenue.

If you want to go deeper on monetization analytics, the Rork × RevenueCat Subscription Monetization Guide is a great next step — combining revenue data with behavioral data gives you the clearest picture of what's actually driving growth.

Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

Dev Tools2026-07-15
The Comma That Fell to the Start of a Line: Rork, Quote Cards, and Japanese Line Breaking
React Native's Text component does not guarantee Japanese line-breaking rules. Here are the violation rates I measured, a WORD JOINER implementation that survives copy and VoiceOver, an onTextLayout audit harness, and how Rork Max (SwiftUI) differs.
Dev Tools2026-07-10
Adding React Compiler to Expo Let Me Delete 41 Hand-Written memo Calls
I enabled React Compiler on Rork-generated React Native screens and measured the rerender counts with Profiler. Here is how I decided which memo and useCallback calls were safe to delete, how to find the components the compiler bailed out on, and how to catch regressions in CI.
Dev Tools2026-07-09
When Amplitude's Funnel Improved Overnight — Field Notes on Catching Event Schema Drift With a Self-Audit
In a Rork-built app, the Amplitude funnel showed signup-to-purchase conversion jumping from 8% to 19% overnight, yet revenue stayed flat. The cause was a property-name drift that inflated the count. Field notes on measuring the drift with an event contract and a runtime validator, then tightening it in stages.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →