React Native SDK
Nohmo ships a first-party React Native SDK under nohmo/react-native. One npm package, two platforms — iOS and Android.
Install
npm install nohmo# Recommended — persists device ID across app restartsnpm install @react-native-async-storage/async-storage# For uninstall detection onlynpm install @react-native-firebase/app @react-native-firebase/messaging
| Package | What it enables | Required? |
|---|---|---|
| nohmo | Core SDK — events, sessions, user identity, screen tracking | Yes |
| @react-native-async-storage/async-storage | Persistent device ID across app restarts (returning-device recognition) | Recommended |
| @react-native-firebase/messaging | Silent daily ping for uninstall detection — requires FCM setup in Settings → App | Optional |
Setup
Add this once in App.tsx. Your Project ID and API key are in Dashboard → Settings → General → SDK credentials.
// App.tsximport { NohmoProvider } from 'nohmo/react-native'import AsyncStorage from '@react-native-async-storage/async-storage'export default function App() {return (<NohmoProviderprojectId="proj_xxxx" // from Settings → General → SDK credentialsapiKey="pk_xxxx"options={{appVersion: '1.0.0',debug: __DEV__,storage: AsyncStorage,}}><YourApp /></NohmoProvider>)}// babel.config.js — add this to auto-track every button tap and screen viewmodule.exports = {presets: ['module:@react-native/babel-preset'],plugins: ['nohmo/babel-plugin'],}
Note: Install attribution (Android Play Store referrer + iOS pasteboard) is built into the SDK — no extra packages needed. The Firebase package is only required for uninstall detection. No extra code needed anywhere in your app beyond the NohmoProvider setup above.
Autocapture — press events & screen views
Add one line to babel.config.js and the SDK tracks every button tap and every screen view automatically — no code changes per component.
// babel.config.jsmodule.exports = {presets: ['module:@react-native/babel-preset'],plugins: ['nohmo/babel-plugin'], // ← add this}
| Event | What triggers it |
|---|---|
| PRESS | Any onPress tap on any component |
| LONG_PRESS | Any onLongPress on any component |
| SCREEN_VIEW | Every navigation state change via NavigationContainer |
The plugin works at compile time — it wraps onPress / onLongPress props and injects onStateChange + onReady on <NavigationContainer>. You never touch those components.
Note: Each PRESS event includes component (e.g. Pressable), text (static label if present), file, and line.
What gets tracked automatically
| Event | Trigger | Data |
|---|---|---|
| APP_INSTALL | First ever app open | platform, appVersion, osVersion |
| APP_OPEN | Every time app becomes active | platform, appVersion |
| APP_BACKGROUND | App goes to background | sessionDurationSecs, screen |
| INSTALL_ATTRIBUTED | Attribution read on first open — Play Store referrer (Android) or pasteboard token (iOS) | utm_source, utm_medium, utm_campaign, nohmo_click |
| PRESS | onPress tap — requires babel plugin | component, text, file, line |
| LONG_PRESS | onLongPress — requires babel plugin | component, text, file, line |
| SCREEN_VIEW | NavigationContainer change — requires babel plugin | screen |
Manual screen tracking (without the plugin)
If you prefer per-screen control or aren't using the Babel plugin, call useScreenView() in each screen component:
import { useScreenView } from 'nohmo/react-native'export default function HomeScreen() {useScreenView('Home') // fires SCREEN_VIEW on mount, TIME_SPENT on unmountreturn <View>…</View>}
Custom events
const { send } = useNohmo()send('button_tapped', { buttonId: 'cta_signup' })send('checkout_started', { cartValue: 49.99 })
Identify users
const { linkUser } = useNohmo()await linkUser(user.id, user.email, { plan: user.plan })
Track conversions
const { trackConversion } = useNohmo()trackConversion('user_created')trackConversion('purchase', { amount: 29.99, currency: 'USD' })
Define conversion goals in Settings → Conversions first. Results appear in Traffic → Conversions.
Deep link attribution
Pass UTM params in your deep link and the SDK captures them automatically on first open:
yourapp://open?utm_source=meta&utm_medium=cpc&utm_campaign=summer
Attribution is attached to every event in that session and appears in Traffic → Attribution.