danscan / rn-redux-mixpanel

Configurable redux middleware that sends your actions & user profile data to Mixpanel. Works with React Native!
67 stars 14 forks source link

Automatically detect information from Device #8

Open ranyefet opened 8 years ago

ranyefet commented 8 years ago

Hi,

Thanks for the great middleware, already using it in development! I've noticed the events I'm sending missing properties that are available when using iOS API. https://mixpanel.com/help/questions/articles/what-properties-do-mixpanels-libraries-store-by-default

Things like: App Release ($app_release) - General build of this app. App Version ($app_version) - Full detail of this app build. Carrier ($carrier) - Wireless carrier of the device owner. iOS Ifa ($ios_ifa) - iOS identifier (IDFA or IDFV, depending on which is available to the app). iOS Version ($os_version) - Current version of iOS on the device. Manufacturer ($manufacturer) - Always Apple (so far...). Lib Version ($lib_version) - Mixpanel library used to send this data. Model ($model) - Device model ID, in format "iPad 3,4". Full list here. Operating System ($os) - "iPhone OS" (outdated naming convention). Screen Height ($screen_height) - Height, in pixels, of the device screen. Screen Width ($screen_width) - Width, in pixels, of the device screen. Wifi ($wifi) - Set to true if Wifi is connected, false if not.

How hard is to integrate it into this middleware?

danscan commented 8 years ago

@ranyefet We'll need to get some of that info (OS version, device model, etc.) from native contexts (iOS, Android) outside of JS itself, which would require a little building, or integration with a different RN module that provides that info.

I'll look deeper into it later this week when I'm back from vacation. I'll check in daily until then, so feel free to submit a PR:)

ranyefet commented 8 years ago

@danscan How about using react-native-mixpanel as dependency? Btw, why are you using superagent instead of built in fetch?

gudmundurmar commented 8 years ago

@ranyefet @danscan Some of the stuff you're looking for should be available in react-native-device-info for React Native at least. So only need to make those properties available for people who are using this with React Native

cgarvis commented 8 years ago

@ranyefet fetch is not built it. IE and Safari require polyfills to use it http://caniuse.com/#feat=fetch. Better to use XMLHttpRequest since it's only used once.

ranyefet commented 8 years ago

@cgarvis fetch is built-in react-native environment and as I understand this module is for react-native. https://facebook.github.io/react-native/docs/network.html#content

cgarvis commented 8 years ago

@ranyefet this project was original redux-mixpanel if I'm not mistaken. No reason this can't support both environments. We could using fetch in browsers that support it and use XMLHttpRequest for those that don't. Since RN has fetch, it should "just work".