You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Mixpanel Flutter SDK is an open-source project, and we'd love to see your contributions!
26
23
We'd also love for you to come and work with us! Check out **[Jobs](https://mixpanel.com/jobs/#openings)** for details
@@ -30,32 +27,47 @@ We'd also love for you to come and work with us! Check out **[Jobs](https://mixp
30
27
Check out our **[official documentation](https://developer.mixpanel.com/docs/flutter)** for more in depth information on installing and using Mixpanel on Flutter.
31
28
32
29
## 1. Install Mixpanel
30
+
33
31
### Prerequisites
32
+
34
33
-[Setup development environment for Flutter](https://flutter.dev/docs/get-started/install)
34
+
35
35
### Steps
36
-
1. Depend on it \
37
-
Add this to your package's pubspec.yaml file:
36
+
37
+
1. Depend on it \
38
+
Add this to your package's pubspec.yaml file:
39
+
38
40
```
39
41
dependencies:
40
42
mixpanel_flutter: ^1.x.x # set this to your desired version
To start tracking with the SDK you must first initialize with your project token. To initialize the SDK, first add `import 'package:mixpanel_flutter/mixpanel_flutter.dart';` and call `Mixpanel.init(token, trackAutomaticEvents);` with your project token and automatic events setting as it's arguments. You can find your token in [project settings](https://mixpanel.com/settings/project).
@@ -73,43 +85,49 @@ class _YourClassState extends State<YourClass> {
73
85
}
74
86
...
75
87
```
88
+
76
89
Once you've called this method once, you can access `mixpanel` throughout the rest of your application.
77
90
78
91
## 3. Send Data
92
+
79
93
Once you've initialized the SDK, Mixpanel will <ahref="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 project settings.
80
94
With the `mixpanel` object created in [the last step](#2-initialize-mixpanel) a call to `track` is all you need to send additional events to Mixpanel.
You're done! You've successfully integrated the Mixpanel Flutter 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-flutter).
104
+
88
105
## 4. Check for Success
89
-
[Open up Events in Mixpanel](https://mixpanel.com/report/events) to view incoming events.
106
+
107
+
[Open up Events in Mixpanel](https://mixpanel.com/report/events) to view incoming events.
90
108
Once data hits our API, it generally takes ~60 seconds for it to be processed, stored, and queryable in your project.
91
109
92
-
👋 👋 Tell us about the Mixpanel developer experience! [https://www.mixpanel.com/devnps](https://www.mixpanel.com/devnps) 👍 👎
110
+
👋 👋 Tell us about the Mixpanel developer experience! [https://www.mixpanel.com/devnps](https://www.mixpanel.com/devnps) 👍 👎
93
111
94
112
# FAQ
95
113
96
114
**I want to stop tracking an event/event property in Mixpanel. Is that possible?**
97
115
98
-
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).
116
+
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).
99
117
100
118
**I have a test user I would like to opt out of tracking. How do I do that?**
101
119
102
-
Mixpanel’s client-side tracking library contains the [optOutTracking()](https://mixpanel.github.io/mixpanel-flutter/mixpanel_flutter/Mixpanel/optOutTracking.html)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/flutter#opting-users-out-of-tracking).
120
+
Mixpanel’s client-side tracking library contains the [optOutTracking()](https://mixpanel.github.io/mixpanel-flutter/mixpanel_flutter/Mixpanel/optOutTracking.html) 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/flutter#opting-users-out-of-tracking).
103
121
104
122
**Why aren't my events showing up?**
105
123
106
-
First, make sure your test device has internet access. 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-flutter/mixpanel_flutter/Mixpanel/flush.html) manually if you want to force a flush at a particular moment.
124
+
First, make sure your test device has internet access. 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-flutter/mixpanel_flutter/Mixpanel/flush.html) manually if you want to force a flush at a particular moment.
107
125
108
126
```
109
127
mixpanel.flush();
110
128
```
111
129
112
-
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-flutter/mixpanel_flutter/Mixpanel/setLoggingEnabled.html) to true, then run your iOS project with Xcode or android project with Android Studio. The logs should be available in the console.
130
+
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-flutter/mixpanel_flutter/Mixpanel/setLoggingEnabled.html) to true, then run your iOS project with Xcode or android project with Android Studio. The logs should be available in the console.
113
131
114
132
```
115
133
mixpanel.setLoggingEnabled(true);
@@ -121,12 +139,14 @@ No, Mixpanel does not use IDFA so it does not require user permission through th
121
139
122
140
**If I use Mixpanel, how do I answer app privacy questions for the App Store?**
123
141
124
-
Please refer to our [Apple App Developer Privacy Guidance](https://mixpanel.com/legal/app-store-privacy-details/)
142
+
Please refer to our [Apple App Developer Privacy Guidance](https://mixpanel.com/legal/app-store-privacy-details/)
125
143
126
144
# I want to know more!
127
145
128
146
No worries, here are some links that you will find useful:
0 commit comments