Mobile apps
Screens, events and users from React Native
You ship an iOS and Android app in React Native, with Expo or without. You want screens, actions and signed-in users in the same place as your website's numbers, and events that survive the app going offline or being closed.
Who it's for
Mobile teams building with React Native.
What you get
| Feature | What it does | Guide |
|---|---|---|
@viakite/react-native | Screens as page views, custom events, identify and reset, for Expo and bare apps | React Native |
| React Navigation and Expo Router | Every screen sent as the user moves | Screens |
| Offline queue | Events kept on the device and sent later, retried with backoff | Sending, offline and retries |
| Users, funnels and retention | People followed across app starts and devices by your user id | Retention |
| Revenue | In-app purchases with revenue and currency | Revenue |
Set it up
Install the SDK
terminal1npx expo install @viakite/react-native @react-native-async-storage/async-storageterminal1npm install @viakite/react-native @react-native-async-storage/async-storageIt needs React Native 0.70 or later. In a bare app, run
npx pod-installfor iOS.Start it and send screens
Copy the public key from Analytics → Install. With Expo Router, in the root layout:
app/_layout.tsx1import { useEffect } from "react";2import { Stack, usePathname } from "expo-router";3import { init, screen } from "@viakite/react-native";45init({ project: process.env.EXPO_PUBLIC_VIAKITE_KEY! });67export default function Layout() {8const pathname = usePathname();9useEffect(() => screen(pathname), [pathname]);10return <Stack />;11}With React Navigation, call
trackNavigation(ref)from the container'sonReadyinstead; see React Navigation.Identify users and send events
src/auth.ts1import { identify, reset, track } from "@viakite/react-native";23identify("user_8231", { plan: "pro" }); // on sign-in4track("Purchase", { revenue: 499, currency: "INR", plan: "pro" });5reset(); // on sign-outThe user id is kept on the device, so it lasts across app starts until
reset().Read the numbers
Screens show in Pages on the hostname
app, events in Events, people in Users, and the app asReactNativein Devices. Build funnels and retention on signed-in users to follow people across days.
What to watch
- React Native only. There is no native Swift, Kotlin or Flutter SDK. From another app, send events through your backend with a secret key: see Backend and server events.
- Allowed hostnames. If your project lists allowed hostnames, add
app(or yourhostoption), or the app's events are dropped. - Old events are dropped. Up to 1,000 events wait on the device, and one older than a day isn't stored.
- One project or two. Use one project for the app and the site to see them together, or a project per app to keep them apart (Projects).
- Crashes and over-the-air updates are Monitoring and Updates, which are coming soon.