Cockpitify Docs Search the docs⌘K Product Sign in Try the live demo

Set up usage analytics

Updated · Pro and up · Phone · Web

Add the Cockpitify SDK to your Expo, React Native, web or Flutter app to see active people, screens and features, split by premium and free.

Usage analytics show who uses your app and which screens and features they use, split by premium and free users. Screens are recorded on their own, and one line of code covers a feature. The data stays in your own Supabase project.

You need Cockpitify installed in the app's Supabase project first. See Connect your Supabase project.

Open the setup screen

  • Phone: open the Product tab. Before any data arrives, tap Set up usage tracking. Later, use Setup and settings at the bottom of the tab. You can also open the app menu (tap the app's name at the top), then Connections → Usage tracking.
  • Web: in the sidebar, open App → Connections and click Usage tracking.

Choose your platform: Expo / RN, Flutter, Web or HTTP. Then pick Code to copy the code, or Paste to your AI assistant for a prompt that does it for you.

Expo and React Native

Install the SDK:

npx expo install @cockpitify/react-native @react-native-async-storage/async-storage

Call Ops.init once, at the top of the root layout, with your app's existing Supabase client. Wrap the layout so screens are recorded:

// app/_layout.tsx
import { Ops } from '@cockpitify/react-native'
import { OpsProvider } from '@cockpitify/react-native/expo-router'
import Constants from 'expo-constants'
import { supabase } from '@/lib/supabase'

Ops.init(supabase, { appVersion: Constants.expoConfig?.version })

export default function RootLayout() {
  return <OpsProvider><Stack /></OpsProvider>
}
  • Using React Navigation instead of Expo Router? Call useOpsNavigation() from @cockpitify/react-native/react-navigation and pass its ref, onReady and onStateChange to NavigationContainer.
  • Screens are recorded by route pattern (/quiz/[id]), not by the real id.
  • AsyncStorage is a native module. If your app didn't have it, you need a new build; an over-the-air update isn't enough.
  • appVersion is what shows version adoption in Release health.

Web

npm install @cockpitify/js
import { Ops } from '@cockpitify/js'
import { supabase } from './supabase'

Ops.init(supabase) // page views are recorded from here on

Id-like parts of a path become [id], so /orders/8412 counts as /orders/[id].

Flutter

The Flutter package (ops_flutter) isn't on pub.dev yet. Until it is, send events over HTTP (below). The setup screen already shows the Flutter code for when it's out: Ops.init(Supabase.instance.client) after Supabase.initialize, and Ops.observer in navigatorObservers.

Any other platform (HTTP)

Send batches of events to your project:

POST https://<project>.supabase.co/rest/v1/rpc/ops_ingest
apikey: <anon key>
Authorization: Bearer <the user's access token, or the anon key before sign-in>

{ "batch": { "v": 1, "sentAt": "…", "device": { "id": "<uuid>", "platform": "android" },
  "events": [ { "id": "<uuid>", "t": "…", "type": "event", "name": "quiz_started", "session": "<uuid>" } ] } }

The setup screen fills in your project's address. Each batch holds 1 to 100 events and at most 64 KB. Send a screen when it is left, with the time spent on it. Events sent before sign-in are linked to the user once they sign in on the same device.

Not using Supabase Auth?

Send the events to your own server instead of the Supabase client:

import { Ops, httpTransport } from '@cockpitify/react-native' // or '@cockpitify/js'

Ops.init(httpTransport({ endpoint: 'https://api.example.com/ops', getToken: () => auth.currentUser?.getIdToken() }))

Your server checks the token and passes the batch on to ops.ingest_batch(user_id, batch, country) in your database.

Record features

Call Ops.track when a feature is really used, not on every tap:

Ops.track('quiz_started', { level: 3 })
  • Names are snake_case, at most 100 characters, with no ids in them: quiz_started, not quiz_42_started.
  • Properties are flat, at most 20 keys, each a string, number or boolean.
  • Never send personal data: no email, name, phone number or text the user typed.
  • Keep names stable. Features, funnels and alerts find events by name.
  • Recording never throws, and calls made before Ops.init wait in a queue.

Where your app shows a paywall, call Ops.paywallView({ offering, placement }) once when it appears. Cockpitify then works out each paywall's conversion.

Check that it works

Open your app, visit a few screens and use a tracked feature. The setup screen shows Waiting for the first event…, then the Integration status list:

  • Events are arriving
  • Screens are recorded: if not, OpsProvider or useOpsNavigation may be missing.
  • Custom events (Ops.track)
  • Events link to users: if not, Ops.init isn't getting your app's signed-in Supabase client.

Live events shows each screen and event within seconds.

What you get

On the phone's Product tab, and on the web under Product → Feature usage:

  • Active people: today, 7 days and 30 days, with the average session and sessions per person a day.
  • Weekly retention by the week people first used the app (ops 0.92.0; before it, the sign-up week).
  • Features, Events and Screens for the last 7 or 30 days, premium and free side by side. Tap a row to see who used it.
  • Funnels, the map and feature impact, and growth and depth.
  • Every screen and event as it happened, under Events → Product events.

Usage alerts

On the phone's Usage tracking screen, turn on Notify me about drops and set the Drop threshold (%) between 10 and 90. You're told when yesterday's active people, or a defined feature's people, fall that far below the 7 days before, or when no data arrives for 12 hours. All alerts are listed on the Alerts page.

Was this page helpful?YesNo
Ask a question
Questions? Ask me.I’m Murat, the indie developer behind Cockpitify.

I read every message and reply by email, usually within a day.