React Native SDK for Aptabase: Open Source, Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps
43
stars
63
commits
TypeScript
primary language
Aug 17, 2026
updated

Instrument your React Native or Expo apps with Aptabase, an Open Source, Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps.
Install the SDK using npm or your preferred JavaScript package manager
npm add @aptabase/react-native
If you're targeting Android, you'll need to add the following permissions to your AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
This SDK also supports React Native Web!
[!NOTE] This feature is disabled by default. To enable it, you need to pass the
enableWeboption when initializing the SDK.
Aptabase.init("<YOUR_APP_KEY>", {
enableWeb: true,
appVersion: "1.0.0", // required on web — no native module provides it
});
When enabled, the SDK will track events in web environments using the same behavior as the web SDKs. Which means that events will be sent immediately to the /event endpoint instead of grouped to the /events endpoint.
First, you need to get your App Key from Aptabase, you can find it in the Instructions menu on the left side menu.
Initialize the SDK by calling the init function before declaring your App component:
import Aptabase from "@aptabase/react-native";
Aptabase.init("<YOUR_APP_KEY>"); // 👈 this is where you enter your App Key
export default function App() {
return <Counter />;
}
Afterwards, you can start tracking events with trackEvent:
import { trackEvent } from "@aptabase/react-native";
import { useState } from "react";
export function Counter() {
const [count, setCount] = useState(0);
const increment = () => {
setCount(count + 1);
trackEvent("increment", { count });
};
const decrement = () => {
setCount(count - 1);
trackEvent("decrement", { count });
};
return (
<View>
<Button onPress={increment} title="Increment" />
<Button onPress={decrement} title="Decrement" />
<Text>Count is {count}</Text>
</View>
);
}
To disable tracking events, you can call the dispose function. This will stop and deinitialize the SDK.
import Aptabase from "@aptabase/react-native";
Aptabase.dispose();
Note for Expo apps: Events sent during development while running on Expo Go will not have the App Version property because native modules are not available in Expo Go. However, when you build your app and run it on a real device, the App Version property will be available. Alternatively, you can also set the appVersion during the init call so that it's also available during development.
A few important notes:
trackEvent manually.
trackEvent function, it'll run in the background.Error reporting is in beta. Reports appear on the
Errorspage of your Aptabase dashboard.
Use trackError to report errors you've caught and handled:
import { trackError } from "@aptabase/react-native";
try {
await doSomething();
} catch (error) {
trackError(error); // severity: error
}
For errors your app can't recover from, mark the report as fatal:
trackError(error, { fatal: true }); // severity: fatal
To also report uncaught errors and crashes automatically, enable crash reporting during init:
Aptabase.init("<YOUR_APP_KEY>", {
enableCrashReporting: true,
});
A few important notes about error reporting:
error or fatal) and how it was captured (handled, unhandled or crash).enableWeb option).trackError from your boundary if you want them reported.When submitting your app to the Apple App Store, you'll need to fill out the App Privacy form. You can find all the answers on our How to fill out the Apple App Privacy when using Aptabase guide.
For AI/LLM integration instructions, see llms.txt
TypeScript
94.4%
Java
3.5%
React Native SDK for Aptabase: Open Source, Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps
43
stars
63
commits
TypeScript
primary language
Aug 17, 2026
updated

Instrument your React Native or Expo apps with Aptabase, an Open Source, Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps.
Install the SDK using npm or your preferred JavaScript package manager
npm add @aptabase/react-native
If you're targeting Android, you'll need to add the following permissions to your AndroidManifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
This SDK also supports React Native Web!
[!NOTE] This feature is disabled by default. To enable it, you need to pass the
enableWeboption when initializing the SDK.
Aptabase.init("<YOUR_APP_KEY>", {
enableWeb: true,
appVersion: "1.0.0", // required on web — no native module provides it
});
When enabled, the SDK will track events in web environments using the same behavior as the web SDKs. Which means that events will be sent immediately to the /event endpoint instead of grouped to the /events endpoint.
First, you need to get your App Key from Aptabase, you can find it in the Instructions menu on the left side menu.
Initialize the SDK by calling the init function before declaring your App component:
import Aptabase from "@aptabase/react-native";
Aptabase.init("<YOUR_APP_KEY>"); // 👈 this is where you enter your App Key
export default function App() {
return <Counter />;
}
Afterwards, you can start tracking events with trackEvent:
import { trackEvent } from "@aptabase/react-native";
import { useState } from "react";
export function Counter() {
const [count, setCount] = useState(0);
const increment = () => {
setCount(count + 1);
trackEvent("increment", { count });
};
const decrement = () => {
setCount(count - 1);
trackEvent("decrement", { count });
};
return (
<View>
<Button onPress={increment} title="Increment" />
<Button onPress={decrement} title="Decrement" />
<Text>Count is {count}</Text>
</View>
);
}
To disable tracking events, you can call the dispose function. This will stop and deinitialize the SDK.
import Aptabase from "@aptabase/react-native";
Aptabase.dispose();
Note for Expo apps: Events sent during development while running on Expo Go will not have the App Version property because native modules are not available in Expo Go. However, when you build your app and run it on a real device, the App Version property will be available. Alternatively, you can also set the appVersion during the init call so that it's also available during development.
A few important notes:
trackEvent manually.
trackEvent function, it'll run in the background.Error reporting is in beta. Reports appear on the
Errorspage of your Aptabase dashboard.
Use trackError to report errors you've caught and handled:
import { trackError } from "@aptabase/react-native";
try {
await doSomething();
} catch (error) {
trackError(error); // severity: error
}
For errors your app can't recover from, mark the report as fatal:
trackError(error, { fatal: true }); // severity: fatal
To also report uncaught errors and crashes automatically, enable crash reporting during init:
Aptabase.init("<YOUR_APP_KEY>", {
enableCrashReporting: true,
});
A few important notes about error reporting:
error or fatal) and how it was captured (handled, unhandled or crash).enableWeb option).trackError from your boundary if you want them reported.When submitting your app to the Apple App Store, you'll need to fill out the App Privacy form. You can find all the answers on our How to fill out the Apple App Privacy when using Aptabase guide.
For AI/LLM integration instructions, see llms.txt
TypeScript
94.4%
Java
3.5%