davide-scalzo / react-native-mixpanel Goto Github PK
View Code? Open in Web Editor NEWA React Native wrapper for Mixpanel tracking
License: MIT License
A React Native wrapper for Mixpanel tracking
License: MIT License
Hi there
There are breaking changes
https://github.com/facebook/react-native/releases/tag/v0.40.0
Curious if any plans to alter this code or if there is a better mixpanel lib for RN
thanks
I suppose that the calls to Mixpanel are asynchronous. Is it safe to just call the functions and let them take care of themselves? Or are there any initializations that needs to be awaited on?
I'm thinking that sharedInstanceWithToken()
might need to be awaited on to ensure everything is initialized before calling track()
etc.
Are any of the functions blocking? It would be great to have some more knowledge of this.
Thank you for a great library.
I'm curious why you're explicitly flushing on most calls? Seems like that's going to consume a fair bit of bandwidth for common uses
@davodesign84
I am using the following snipped to trigger check_in event to mixpanel. I am unable to see the event in Live View on Mixpanel Dashboard.
const Mixpanel = require('react-native-mixpanel')
Mixpanel.sharedInstanceWithToken(config.mixpanel.token)
Mixpanel.trackWithProperties('check_in', {
type: type,
user_id: user.id.toString(),
status: 'success',
table_id: table_id.toString(),
restaurant_id: restaurant_id.toString(),
admin_user_id: admin_user_id.toString(),
waiter_user_id: waiter_user_id.toString(),
event_timestamp: (new Date().getTime()).toString()
})
Hi,
I am using react-native-mixpanel in an app I am working on and the features it is supporting are all working great. I noticed you do not have a wrapper around:
[mixpanel showSurveyWithID:CALL_QUALITY_SURVEY_ID]
Which is used to show a survey when the default behavior ( show the survey on load ) is not enabled. Is there a reason this was not implemented? If there isn't then I can go ahead and try adding the functionality and push it back to you, just wanted to see if there is some large difficulty you ran into that caused you to leave this out.
edit, nvm
Hey,
juts a tiny typo in the docs I guess. To track a charge with properties I needed to call trackChargeWithProperties
instead of just trackCharge
.
Hello,
This just tripped me up - It looks like the mixpanel function allows non string types:
https://mixpanel.com/site_media/doctyl/uploads/iPhone-spec/Classes/MixpanelPeople/index.html#//apple_ref/occ/instm/MixpanelPeople/set:
But here it's limiting to string: https://github.com/davodesign84/react-native-mixpanel/blob/master/RNMixpanel/RNMixpanel.m#L75
Any reason why set
doesn't take an NSDictionary instead of key, value?
Thanks,
Elliott
would this be possible? Thanks
I just installed react-native-mixpanel
via npm and the version that gets installed is 0.0.10
, but it seems to have a different version of the code than found here. Most notably the Mixpanel.set
method has a different signature than here on GitHub:
@ReactMethod
public void set(final String key, final String value) {
mixpanel.getPeople().set(key, value);
}
The generated package.json shows me that this is the file that it's fetching:
https://registry.npmjs.org/react-native-mixpanel/-/react-native-mixpanel-0.0.10.tgz, and I have fetched it manually untarred it and found the same offending code. It seems to me that the version on npm is before this commit:
06f0fd1
/Users/dwilt/Projects/GJS/gjs-app/node_modules/react-native-mixpanel/android/src/main/java/com/kevinejohn/RNMixpanel/RNMixpanelModule.java:263: error: cannot find symbol
public void getDistinctId(Callback callback) {
^
symbol: class Callback
location: class RNMixpanelModule
1 error
:react-native-mixpanel:compileReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
After this merge, I'm getting this error on an Android build. I think we're missing a Class reference?
My app crashed if I turned off the internet.
2016-07-26 17:55:53.311 [warn][tid:com.facebook.react.JavaScript] Error: TypeError: Network request failed
2016-07-26 17:55:53.317 [error][tid:com.facebook.react.RNMixpanelQueue][RCTModuleMethod.m:470] RNMixpanel.track was called with 2 arguments, but expects 1. If you haven't changed this method yourself, this usually means that your versions of the native code and JavaScript code are out of sync. Updating both should make this error go away.
2016-07-26 17:55:53.336 [error][tid:com.facebook.react.JavaScript] Module RCTLog is not a registered callable module.
2016-07-26 17:55:53.339 [fatal][tid:com.facebook.react.RCTExceptionsManagerQueue] Unhandled JS Exception: Module RCTLog is not a registered callable module.
Is it even possible to take advantage of Mixpanel's codeless tracking feature (supported by the native iOS SDK) in a react native app? Currently if you navigate to the wysiwyg editor in Mixpanel you can get the app to render but it shows that there are no trackable elements on the screen.
Did I set it up wrong or is this not a supported feature?
I would like to use this package, but require a LICENSE.txt
It would be nice to support getting the Mixpanel function "get distinct id". For instance if you want to store the identity in a database to reuse it on the web for the same user
I keep getting this error when following your tutorial or using rnpm.
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_Mixpanel", referenced from:
objc-class-ref in libRNMixpanel.a(RNMixpanel.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The section of the installation entitled On newer versions of React Native (0.18+): is ambiguous.
Does the package not support React Native below 0.18?
Do those using React Native below 0.18 have to follow some alternative instructions?
How does this relate to the steps prior to this section? Must it be completed instead of, or in addition to?
Or is none of the above true?
I think the installation instructions should be updated to be more clear about what installation path a user must follow, depending on the version of React Native that they are using.
Hello!
I'm having an issue with the exports, I did :
const Mixpanel = require('react-native-mixpanel');
console.info(Mixpanel); // undefined
Mixpanel.sharedInstanceWithToken(TOKEN); // cannot read property 'sharedInstanceWithToken' of undefined
Using:
"react": "15.2.1",
"react-native": "0.31.0",
"react-native-mixpanel": "0.0.10"
Even though I linked the library using react-native link react-native-mixpanel
which was linked successfully.
Following the instructions, I wasn't able to track events or identify users until I called [Mixpanel sharedInstanceWithToken:MIXPANEL_TOKEN];
from objc. I didn't get any errors...I just didn't see any of the events in my mixpanel dashboard.
(I needed to call sharedInstanceWithToken
in JS and in objc)
Note: mixpanel library was installed manually, not from cocoapods.
I used cocoapods to install mixpanel, and I tried calling sharedInstanceWithToken
in both the AppDelegate and in my index.ios.js
. I also tried calling flush
explicitly after calling track
, but I never see any network requests going out.
Has anybody gotten this working with flow?
Add a way to access current super property. Like the method in javascript sdk get_property()
.
I get the following error when I added mixpanel to my existing project. I installed the SDK and linked the appropriate files as documented.
Undefined symbols for architecture x86_64:
"_utf8_nextCharSafeBody", referenced from:
_validate_dispatch_data_partial_string in libMixpanel.a(MPWebSocket.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Xcode is complaining about duplicate methods:
RCT_EXPORT_METHOD(addPushDeviceToken:(NSData *)deviceToken) {
[mixpanel.people addPushDeviceToken:deviceToken];
}
and
// addPushDeviceToken
RCT_EXPORT_METHOD(addPushDeviceToken:(NSString *)pushDeviceToken) {
[mixpanel.people addPushDeviceToken:pushDeviceToken];
}
which one should we keep?
RN has a different application template from RN version 0.29.0. So updating this package to support that would make sense.
Sure this one was such a good idea ?
2 remarks:
I dont have time to look at it now, this was just a heads up, cheers
Might submit a PR when i get around to it
Hi guys I'm getting this on a fresh react native project when i include this component. PS -> I first fixed the duplicate method issue manually from the master by replacing RNMixpanel.m
Full error:
Undefined symbols for architecture x86_64:
"OBJC_CLASS$_Mixpanel", referenced from:
objc-class-ref in libRNMixpanel.a(RNMixpanel.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Current react versions:
"react": "15.4.1",
"react-native": "0.39.2",
"react-native-mixpanel": "0.0.11"
Hope you can help.
I followed the instruction from documentation. have installed SDK and trying to link library to my project. And I get following error while building my project.
/Users/.../node_modules/react-native-mixpanel/RNMixpanel/RNMixpanel.m:12:9: Module 'React' not found
header search path is as follows
$(inherited) => non-recursive
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include => recursive
$(SRCROOT)/../../React => recursive
$(SRCROOT)/../../node_modules/react-native/React => recursive
Am I missing something? I am using react-native 0.25.1
Hi, thanks for the great package. Do you have plans to add people properties?
Hi @davodesign84, thank you for making this library! We have been using it in our organization to show in-app notifications. It works really well on iOS. We are having some troubles with Android where the in-app notification is not shown.
With all the new react-native releases, are you still planning on maintaining this library? Do you need help in maintaining?
I see that @kevinejohn has worked on most of the android part. Are you still using this library and maintaining a fork of it @kevinejohn?
I am curious!
Seems to due to the Podfile dependency on React
.
Failed to build DependencyGraph: @providesModule naming collision:
Duplicate module name: react-native-packager
Paths: /project/node_modules/react-native/packager/package.json collides with /project/ios/Pods/React/packager/package.json
This error is caused by a @providesModule declaration with the same name across two different files.
Error: @providesModule naming collision:
Duplicate module name: react-native-packager
Paths: /project/node_modules/react-native/packager/package.json collides with /project/ios/Pods/React/packager/package.json
Also when doing pod install
I get a warning:
[!] React has been deprecated
I've tested this on react-native 0.38 and 0.39.
This is my Podfile in react-native ios-directory:
use_frameworks!
target 'project' do
pod 'react-native-mixpanel', :path => '../node_modules/react-native-mixpanel/react-native-mixpanel.podspec'
end
Simple removing the s.dependency 'React'
from the Podfile creates other problems:
/project/node_modules/react-native-mixpanel/RNMixpanel/RNMixpanel.h:9:9: 'RCTBridgeModule.h' file not found
/project/node_modules/react-native-mixpanel/RNMixpanel/RNMixpanel.m:10:9: In file included from /project/node_modules/react-native-mixpanel/RNMixpanel/RNMixpanel.m:10:
And no matter what I add to react-native-mixpanels xcode Build Settings when it comes to Header/Library/Framework search paths I can't get RNMixpanel.m
to find RCTBridgeModule.h
... (even though it resides in /project/node_modules/react-native/React/Base
)
Would be awesome if somebody could implement addPushDeviceToken ๐
I think this is an essential feature of mixpanel.
@kevinejohn thanks for integrating this library with Android. Could you please provide the setOnce method also? So we have future parity with the iOS Version.
Thanks!
Hi, thanks for the great work. I think there's a typo in the RN version in the package.json (should be >= 0.11.0, not >=11.0.0). Thanks.
Hey,
Is there an implementation example for the addPushDeviceToken method that takes NSData and not NSString?
Can't really figure out how can I encode the plain token string I'm getting in RN, so the token will passed to the native side as NSData.
Thanks!
Guy
I have followed the steps for manual installation and followed the following link https://blog.mixpanel.com/2014/09/30/integrating-the-mixpanel-ios-sdk-without-cocoapods/
In the 4th step of this link, we have to add this line
[Mixpanel sharedInstanceWithToken:MIXPANEL_TOKEN];
in launchOptions function of appDelegate.m.
However, when i add this line it shows error : use of undeclared identifier 'MIXPANEL_TOKEN'
.
and if I remove [Mixpanel sharedInstanceWithToken:MIXPANEL_TOKEN];
and the #import "Mixpanel.h"
from appDelegate.m , the build succeeds.
What should I do ?
Hi, I'm pretty new to iOS and developing with cocoapod, so I apologise in advance if this is a rookie mistake.
I get a build error after following installation step 5 (Add libRNMixpanel.a to your project's Build Phases).
This is the the error:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_Mixpanel", referenced from:
objc-class-ref in libRNMixpanel.a(RNMixpanel.o)
(I get the same error when building for simulator, but with x86_64)
I'm pretty sure I'm doing step 5 correctly, but I am wondering if I'm not following step 6 correctly?
I go to the RNMixpanel.xcodeproj in my Project/Libraries folder, then edit the Header Search Paths like this -
$(inherited)
/Applications/Xcode.app/Contents/Developer/Toolchains/........
$(SRCROOT)/../../React
$(SRCROOT)/../../node_modules/react-native/React
$(SRCROOT)/../react-native/React
All recursive except inherited.
I also think it could be another issue with the installation of the cocoapod having to be for a specific version of ios, or not having copied some files across. Do you have any idea why I would be getting this problem?
Thanks
library not found for -lMixpanel
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS =
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Mixpanel"
OTHER_CFLAGS =
OTHER_LDFLAGS = $(inherited) -ObjC -l"Mixpanel" -l"icucore" -framework "Accelerate" -framework "CoreGraphics" -framework "CoreTelephony" -framework "Foundation" -framework "QuartzCore" -framework "SystemConfiguration" -framework "UIKit"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR =
PODS_ROOT = ${SRCROOT}/Pods
that is my generated pods.. I have Mixpanel directory on my project I already add the inherited paths on the links all the configuration was done.. But still the Mixpanel is missing. Please help thanks
I am using the following lines of test code to track users of my app. It will fire and show the selected events for the user in Mixpanel, but it doesn't seem to set any of the people properties.
Is this a known issue or am I doing something incorrectly?
Hey there,
So as per the docs I tried calling track charge with a few props but ran into the error mentioned above.
This is my call:
Mixpanel.trackCharge(this.props.variant.price, {'variant id':this.props.variant.id,'variant name':this.props.variant.title});
I am on version 0.0.10 of the package. Any advice would be appreciated :)
I track the data use Charles with SSL
found that iOS do post data to @/engage/
so mixpanel will create a person for you
But Android did not post the data.
I'm getting the same error as in #6 . Tried setting the Other Linker Flags with no results. Any tips?
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_Mixpanel", referenced from: objc-class-ref in libRNMixpanel.a(RNMixpanel.o)
This does not fire session end
mixpanel.track('session_end')
mixpanel.reset()
this does
mixpanel.reset()
Maybe the docs should be updated to point out that you should do something like this instead
Promise.resolve(mixpanel.track('session_end'))
.then(mixpanel.reset)
Happy to make a PR if you all think it makes sense.
I'm not sure if this is an error, or just a misunderstanding on my behalf about how cocoapods works - but if I try to run pod update
in my project, with the line:
pod 'RNMixpanel', :path => 'node_modules/react-native-mixpanel'
It complains with The name of the given podspec 'react-native-mixpanel' doesn't match the expected one 'RNMixpanel'
. Because the podspec file is RNMixpanel.podspec
, but in the spec it has s.name = "react-native-mixpanel"
.
I think it should be either s.name = "RNMixpanel"
it works if I do this), or the other way around (react-native-mixpanel.podspec).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.