◉RORK LABJP
●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SDK 58 — Beta since 09/15 with no stable date yet; running projects in Expo Go has required login since 09/03●WIDGET — A write-up traces an iOS widget that renders black only in production builds●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…●GPT-6.1 SOL — Added to Rork's model menu (09-29) with Low, Medium and High effort; included on Pro and Max●SONNET 5.5 — Claude Sonnet 5.5 is selectable: strong at UI design and faster than Sonnet 5 (09-28)●SDK 58 — Beta since 09/15 with no stable date yet; running projects in Expo Go has required login since 09/03●WIDGET — A write-up traces an iOS widget that renders black only in production builds●OBSERVE — EAS Observe now records native crashes too (SDK 57.0.21 or later, 10/07)●NEW — My App Open Ad Only Showed When the App…
Articles/Dev Tools
⬡ Dev Tools/2026-06-03Advanced

Guarding Analytics Events With Types Across Six Rork Apps — A Shared Event Layer

After event names drifted across six apps and quietly broke my dashboards, I built a typed event registry and a thin wrapper to centralize tracking, plus a CI check that catches schema drift. Here is the design, with the code I actually use.

Rork585analytics5TypeScript8Firebase10architecture13

✦ Premium Article

When I tried to look at "save button taps" for one of my wallpaper apps after about six months, the chart had dropped to zero on a specific day. It was not an outage. In some update, while doing unrelated work, I had renamed the event wallpaper_save to save_wallpaper. The app ran fine, nothing crashed, and only the analytics dashboard quietly died. For half a year, the same action had been split across two names, and nobody noticed.

I have been building apps on my own since 2014, and they have reached around 50 million downloads in total. These days I run six wallpaper apps in parallel using Rork, and the more apps you have, the worse this "event names rot in silence" problem gets. The same act of "saving a wallpaper" ends up with slightly different names in each app, and before long you can no longer analyze across them. This article records the design of a shared event layer that locks this problem down with types, along with the code I actually use.

Why Event Names Rot in Silence

The insidious thing about analytics events is that nothing breaks when they are wrong. Whether you write save_btn_tap, wallpaper_saved, or tap_save, as long as it is passed as a string to logEvent(name, params), the app behaves normally. The type system, the linter, and your tests never look inside the string. The error is detected six months later, by the human eyes of whoever opens the dashboard.

With six apps, this gets exponentially worse. In my experience, leaving it unmanaged led to three kinds of rot progressing at once. First, naming drift: the same action had three coexisting names, wallpaper_save / save_wallpaper / img_save. Second, missing properties: one app was not sending the category property, so I could not break saves down by category. Third, type mismatches: some apps sent is_premium as the string "true" while others sent the boolean true, and Firebase counted them as separate things.

The root cause of all of these is that "you can send anything as a string with an any type." So the starting point of this design is simple: close off the sending path with types.

A Typed Event Registry as the Single Source of Truth

First, consolidate every event definition into a single file. Declare each event name and the shape of its properties as types, and make it impossible to send any event not listed here.

// packages/analytics/src/events.ts
// The "event dictionary" shared across six apps. This is the only truth.
 
export const EVENTS = {
  wallpaper_save: {
    category: "string",      // wallpaper category ID
    wallpaper_id: "string",
    source: "string",        // "detail" | "list" | "widget"
  },
  wallpaper_set_lockscreen: {
    wallpaper_id: "string",
  },
  paywall_view: {
    placement: "string",     // which screen it came from
    variant: "string",       // A/B test branch
  },
  subscribe_complete: {
    plan: "string",          // "monthly" | "yearly"
    price_jpy: "number",
  },
} as const;
 
// Derive each event's property types automatically from EVENTS
type PropType<T> = T extends "string" ? string
  : T extends "number" ? number
  : T extends "boolean" ? boolean
  : never;
 
export type EventName = keyof typeof EVENTS;
 
export type EventProps<E extends EventName> = {
  [K in keyof typeof EVENTS[E]]: PropType<typeof EVENTS[E][K]>;
};

This EVENTS object is both a dictionary and a contract. Adding a new event means adding a line here, where it shows up as a list during review. Because the property types are declared too, passing a string to price_jpy simply will not compile.

My grandfather, who was a temple carpenter, used to say: "Decide the dimensions first, and after that you only have to honor them." An event schema works the same way. Decide the dimensions (the types) in one place, and each app's implementation only has to honor them.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦A typed event registry that catches event-name typos and drift at compile time
✦A single thin wrapper across six apps that prevents missing common properties
✦A CI check that detects event-definition drift so dashboards never break silently
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
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 →

Related Articles

⬡ Dev Tools2026-05-19
Rolling Out Firebase App Check in Rork Without Breaking AdMob or Crashlytics
A practical, staged rollout for Firebase App Check in Rork apps that keeps Crashlytics reporting, Realtime Database listeners, and AdMob payouts intact — written from running AdMob-funded indie apps in production.
⬡ Dev Tools2026-10-15
When EXPO_PUBLIC_ Values Read Fine in Dev but Come Back undefined in Production: Telling the Spellings Apart
The API URL reads fine while developing and turns undefined once the app is built. The cause was how process.env was written. I lined up babel-preset-expo's output for dev and production and tabulated which spellings get replaced and which are left behind.
⬡ Dev Tools2026-10-13
Before You Ship: Go Looking for Your Own Keys Inside the Exported Expo Bundle
A key can be missing from your source and still be sitting inside the finished app. I ran expo export on Expo SDK 57, searched the bundle with grep and a short Node script, and recorded which secrets show up and which don't.