mixpanel / mixpanel-react-native

Official React Native Tracking Library for Mixpanel Analytics
https://mixpanel.com
Apache License 2.0
105 stars 44 forks source link

mixpanel react native package not sending events #218

Closed rubensavio closed 9 months ago

rubensavio commented 9 months ago

Been using mixpanel for few years now, most of my react native projects were running on mixpanel packages only. I just tried a simple app today implmenting mixpanel for a demo and the events are not pushed either that or dashboard is not displaying. Below is the simple app code.

import React, {Component} from 'react'; import { Mixpanel } from 'mixpanel-react-native';

const mixpanel = new Mixpanel("Project token"); mixpanel.init(); mixpanel.flush(); import {StyleSheet, TouchableOpacity, Text, View} from 'react-native';

class App extends Component { state = { count: 0, };

onPress = () => { mixpanel.track('First event') this.setState({ count: this.state.count + 1, }); };

render() { return (

Click me You clicked {this.state.count} times
);

} }

const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', }, button: { alignItems: 'center', backgroundColor: '#DDDDDD', padding: 10, marginBottom: 10, }, });

export default App;

can you guys let me know if am missing something

zihejia commented 9 months ago

hi @rubensavio , please make sure your test device has access to the internet and the project token is correct. also please refer to the section Why aren't my events showing up? in the FAQ: https://github.com/mixpanel/mixpanel-react-native#faq If still not working, please contact our support. Thank you!