Skip to content

Commit b06920e

Browse files
committed
Improve the quick start guide
1 parent 46876c0 commit b06920e

File tree

1 file changed

+46
-15
lines changed

1 file changed

+46
-15
lines changed

README.md

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
12
<div align="center" style="text-align: center">
23
<img src="https://github.com/mixpanel/mixpanel-android/blob/assets/mixpanel.png?raw=true" alt="Mixpanel React Native Library" height="150"/>
34
</div>
45

56
#####
6-
# Table of Contents
7+
## Table of Contents
78

89
<!-- MarkdownTOC -->
910
- [Introduction](#introduction)
@@ -15,31 +16,30 @@
1516
<!-- /MarkdownTOC -->
1617

1718

18-
# Introduction
19+
## Introduction
1920
Welcome to the official Mixpanel React Native library.
2021
The Mixpanel React Native library is an open-source project, and we'd love to see your contributions!
2122
We'd also love for you to come and work with us! Check out **[Jobs](https://mixpanel.com/jobs/#openings)** for details
2223

23-
# Quick Start Guide
24+
## Quick Start Guide
2425

2526
Mixpanel's React Native SDK is a wrapper around Mixpanel’s native iOS and Android SDKs and it supports offline tracking. Check out our **[official documentation](https://developer.mixpanel.com/docs/react-native)** for more in depth information on installing and using Mixpanel on React Native.
2627

2728
<a name="installation"></a>
28-
## Installation
29-
### Prerequisites
29+
### 1. Install Mixpanel
30+
#### Prerequisites
3031
- React Native v0.6+
3132
- [Setup development environment for React Native](https://reactnative.dev/docs/environment-setup)
32-
### Steps
33+
#### Steps
3334
1. Under your app's root directory, install Mixpanel React Native SDK
3435
```npm install mixpanel-react-native```
3536
2. Under your application's ios folder, run
3637
```pod install```
37-
Please note: You don't need to update your Podfile to add Mixpanel manually.
38+
Please note: You do not need to update your Podfile to add Mixpanel.
3839
3. For Xcode 12.5+, there is a known compile issue, please refer to this **[workaround](https://github.com/mixpanel/mixpanel-react-native/issues/43#issuecomment-829599732)**.
3940

4041

41-
## Integration
42-
### Initialization
42+
### 2. Initialize Mixpanel
4343
To start tracking with the library you must first initialize with your project token. To initialize the library, first add `import { Mixpanel }` and call `Mixpanel.init(token)` with your project token as it's argument.
4444
```js
4545
import { Mixpanel } from 'mixpanel-react-native';
@@ -56,19 +56,50 @@ class YourClass extends React.Component {
5656
...
5757
```
5858
Once you've called this method once, you can access `mixpanel` throughout the rest of your application.
59-
### Tracking
60-
Once you've initialized the library, Mixpanel will <a href="https://mixpanel.com/help/questions/articles/which-common-mobile-events-can-mixpanel-collect-on-my-behalf-automatically" target="_blank">automatically collect common mobile events</a>. You can enable/ disable automatic collection through your <a href="https://mixpanel.com/help/questions/articles/how-do-i-enable-common-mobile-events-if-i-have-already-implemented-mixpanel" target="_blank">project settings</a>.
61-
With the `mixpanel` object created in [the last step](#integration) a call to `track` is all you need to send additional events to Mixpanel.
59+
### 3. Send Data
60+
Let's get started by sending event data. You can send an event from anywhere in your application. Better understand user behavior by storing details that are specific to the event (properties). After initializing the library, Mixpanel will [automatically collect common mobile events](https://mixpanel.com/help/questions/articles/which-common-mobile-events-can-mixpanel-collect-on-my-behalf-automatically). You can enable/disable automatic collection through your project settings. Also, Mixpanel automatically tracks some properties by default; [learn more](https://help.mixpanel.com/hc/en-us/articles/115004613766-Default-Properties-Collected-by-Mixpanel).
6261
```js
6362
// Track with event-name
6463
mixpanel.track('Sent Message');
6564
// Track with event-name and property
6665
mixpanel.track('Plan Selected', {'Plan': 'Premium'});
6766
```
68-
You're done! You've successfully integrated the Mixpanel React Native SDK into your app. To stay up to speed on important SDK releases and updates, star or watch our repository on [Github](https://github.com/mixpanel/mixpanel-react-native).
69-
67+
In addition to event data, you can also send [user profile data](https://developer.mixpanel.com/docs/react-native#storing-user-profiles). We recommend this after completing the quickstart guide.
68+
### 4. Check for Success
69+
[Open up Live View in Mixpanel](http://mixpanel.com/report/live) to view incoming events.
70+
Once data hits our API, it generally takes ~60 seconds for it to be processed, stored, and queryable in your project.
7071
<a name="i-want-to-know-more"></a>
71-
# I want to know more!
72+
73+
## FAQ
74+
**I want to stop tracking an event/event property in Mixpanel. Is that possible?**
75+
Yes, in Lexicon, you can intercept and drop incoming events or properties. Mixpanel won’t store any new data for the event or property you select to drop. [See this article for more information](https://help.mixpanel.com/hc/en-us/articles/360001307806#dropping-events-and-properties).
76+
77+
**I have a test user I would like to opt out of tracking. How do I do that?**
78+
Mixpanel’s client-side tracking library contains the [optOutTracking()](https://mixpanel.github.io/mixpanel-react-native/Mixpanel.html#optOutTracking) method, which will set the user’s local opt-out state to “true” and will prevent data from being sent from a user’s device. More detailed instructions can be found in the section, [Opting users out of tracking](https://developer.mixpanel.com/docs/react-native#opting-users-out-of-tracking).
79+
80+
**Why aren't my events showing up?**
81+
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()](https://mixpanel.github.io/mixpanel-react-native/Mixpanel.html#flush) manually if you want to force a flush at a particular moment.
82+
83+
```
84+
mixpanel.flush();
85+
86+
```
87+
88+
If your events are still not showing up after 60 seconds, check if you have opted out of tracking. You can also enable Mixpanel debugging and logging, it allows you to see the debug output from the Mixpanel library. To enable it, call [setLoggingEnabled](https://mixpanel.github.io/mixpanel-swift/Classes/MixpanelInstance.html#/s:8Mixpanel0A8InstanceC14loggingEnabledSbvp) to true, then run your iOS project with Xcode or android project with Android Studio. The logs should be available in the console.
89+
90+
```
91+
mixpanel.setLoggingEnabled(true);
92+
93+
```
94+
95+
**Starting with iOS 14.5, do I need to request the user’s permission through the AppTrackingTransparency framework to use Mixpanel?**
96+
No, Mixpanel does not use IDFA so it does not require user permission through the AppTrackingTransparency(ATT) framework.
97+
98+
**If I use Mixpanel, how do I answer app privacy questions for the App Store?**
99+
Please refer to our [Apple App Developer Privacy Guidance](https://mixpanel.com/legal/app-store-privacy-details/)
100+
101+
102+
## I want to know more!
72103
73104
No worries, here are some links that you will find useful:
74105
* **[Sample app](https://github.com/mixpanel/mixpanel-react-native/tree/master/MixpanelDemo)**

0 commit comments

Comments
 (0)