Step 1: Install the SDK

Under your app's root directory, run:

npm install mixpanel-react-native

Under your application's iOS folder, run:

pod install

Note: For XCode 12.5+, there is a known compile issue, please refer to this workaround (opens in a new tab).

Step 2: Track your first event

You'll need your Project Token for this, which you can get here (opens in a new tab).

import React from 'react';
import { Button, SafeAreaView } from "react-native";
import { Mixpanel } from 'mixpanel-react-native';
const trackAutomaticEvents = true;
const mixpanel = new Mixpanel("Your Token", trackAutomaticEvents);
const SampleApp = () => {
  return (
        title="Select Premium Plan"
        onPress={() => mixpanel.track("Signed Up", {"Signup Type": "Referral"})}
export default SampleApp;

🎉 Congratulations, you've tracked your first event! You can see it in Mixpanel via the Events (opens in a new tab) page.

For more options, see the reference and code for each SDK in Github (opens in a new tab).


Why aren't my events showing up?

To preserve battery life and customer bandwidth, the Mixpanel library doesn't send the events you record immediately. Instead, it sends batches to the Mixpanel servers every 60 seconds while your application is running, as well as when the application transitions to the background. You can call .flush() manually if you want to force a flush at a particular moment for example before your application is completely shutdown. See our debugging guide.

How do I opt users out of tracking?

Call the .optOutTracking() method, which will prevent data from being sent from the user’s device.

Starting with iOS 14.5, do I need to request the user’s permission through the AppTrackingTransparency framework to use Mixpanel?

No, Mixpanel does not use IDFA so it does not require user permission through the AppTrackingTransparency(ATT) framework.

If I add Mixpanel tracking to my iOS app, how do I answer app privacy questions for the App Store?

Please refer to our Apple App Developer Privacy Guidance (opens in a new tab)