GithubHelp home page GithubHelp logo

davide-scalzo / react-native-mixpanel Goto Github PK

View Code? Open in Web Editor NEW
454.0 14.0 194.0 162 KB

A React Native wrapper for Mixpanel tracking

License: MIT License

Ruby 0.68% Objective-C 60.40% JavaScript 18.33% Java 20.59%
react-native mixpanel-sdk android ios-app xcode notifications mixpanel-ios-sdk java mobile-app

react-native-mixpanel's Introduction

DEPRECATED

Please check out the official bindings at https://github.com/mixpanel/mixpanel-react-native

npm

npm

Description

React Native wrapper for Mixpanel library, on top of the regular javascript sdk you can normally use, this provides you all the goodies of the native wrapper including notifications, analysis of the operating system, surveys etc..

If you'd like to support, you can donate some Ether to this address: 0x4cD5D72FFd950260e47F9e14F45811C5cCDD0283

Installation

  • Run npm install react-native-mixpanel --save
  • Run react-native link react-native-mixpanel
    • (for RN 0.29.1+; otherwise use rnpm link react-native-mixpanel)

Additional Step for iOS

  • Install Mixpanel iOS SDK via either Cocoapods or manually more info here

Additional info for Android (version >= 1.1.2)

From version 1.1.2 module uses Mixpanel SDK >= 5.6.0 that requires FCM

  • Migration steps can be found here
  • Allow sub-classes to override push notifications payload and Support when more than one push provider is used more info here

Autolinking and RN >= 0.60

Autolinking should work out of the box.

Remember to do: pod install.

Manual Installation

Installation iOS

  1. npm install react-native-mixpanel --save
  2. Install Mixpanel iOS SDK via either Cocoapods or manually more info here
  3. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  4. Go to node_modulesreact-native-mixpanel and add RNMixpanel.xcodeproj
  5. In XCode, in the project navigator, select your project. Add libRNMixpanel.a to your project's Build PhasesLink Binary With Libraries
  6. Click RNMixpanel.xcodeproj in the project navigator and go the Build Settings tab. Make sure 'All' is toggled on (instead of 'Basic'). Look for Header Search Paths and make sure it contains both $(SRCROOT)/../react-native/React and $(SRCROOT)/../../React - mark both as recursive.
  7. Run your project (Cmd+R)

Installation Android

  • In android/setting.gradle
...
include ':react-native-mixpanel', ':app'
project(':react-native-mixpanel').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mixpanel/android')
  • In android/app/build.gradle
...
dependencies {
    ...
    compile project(':react-native-mixpanel')
}
  • register module (in MainActivity.java)

On newer versions of React Native register module (MainApplication.java):

import com.kevinejohn.RNMixpanel.*;  // <--- import

public class MainActivity extends ReactActivity {
  ......

  /**
   * A list of packages used by the app. If the app uses additional views
   * or modules besides the default ones, add more packages here.
   */
    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
        new RNMixpanel(), // <------ add here
        new MainReactPackage());
    }
}

Usage

// Require the module
var Mixpanel = require('react-native-mixpanel');

// Init Mixpanel SDK with your project token
//  @param apiToken - your project token
Mixpanel.sharedInstanceWithToken(YOUR_PROJECT_TOKEN);

// You can also opt out tracking by default (GDPR)
//  @param apiToken - your project token
//  @param optOutTrackingByDefault - whether or not to be opted out from tracking by default (default value: false)
Mixpanel.sharedInstanceWithToken(YOUR_PROJECT_TOKEN, false);

// You can also disable trackCrashes
//  @param apiToken - your project token
//  @param optOutTrackingByDefault - whether or not to be opted out from tracking by default (default value: false)
//  @param trackCrashes (iOS only!) - whether or not to track crashes in Mixpanel. may want to disable if you're seeing  issues with your crash reporting for either signals or exceptions (default value: true)
Mixpanel.sharedInstanceWithToken(YOUR_PROJECT_TOKEN, false, true);

// You can also disable automaticPushTracking
//  @param apiToken - your project token
//  @param optOutTrackingByDefault - whether or not to be opted out from tracking by default (default value: false)
//  @param trackCrashes (iOS only!) - whether or not to track crashes in Mixpanel. may want to disable if you're seeing  issues with your crash reporting for either signals or exceptions (default value: true)
//  @param automaticPushTracking (iOS only!) - whether or not to automatically track pushes sent from Mixpanel (default value: true)
Mixpanel.sharedInstanceWithToken(YOUR_PROJECT_TOKEN, false, true, true);

// You can also pass launchOptions
//  @param apiToken - your project token
//  @param optOutTrackingByDefault - whether or not to be opted out from tracking by default (default value: false)
//  @param trackCrashes (iOS only!) - whether or not to track crashes in Mixpanel. may want to disable if you're seeing  issues with your crash reporting for either signals or exceptions (default value: true)
//  @param automaticPushTracking (iOS only!) - whether or not to automatically track pushes sent from Mixpanel (default value: true)
//  @param launchOptions (iOS only!) - your application delegate's launchOptions (default value: null)
Mixpanel.sharedInstanceWithToken(YOUR_PROJECT_TOKEN, false, true, true, null);

// Opt in tracking.
// Use this method to opt in an already opted out user from tracking. People updates and track calls will be sent to Mixpanel after using this method.
Mixpanel.optInTracking();

// Opt out tracking.

// This method is used to opt out tracking. This causes all events and people request no longer to be sent back to the Mixpanel server.
Mixpanel.optOutTracking();

// Send and event name with no properties
Mixpanel.track("Event name");

// Track event with properties
Mixpanel.trackWithProperties('Click Button', {button_type: 'yellow button', button_text: 'magic button'});

// Create Alias from unique id, i.e. create a new mixpanel profile: to call when a user signs up, with a unique id that is not used by another mixpanel profile as param
Mixpanel.createAlias(UNIQUE_ID)

// OR: 

// Create an alias, which Mixpanel will use to link two distinct_ids going forward (not retroactively). Multiple aliases can map to the same original ID, but not vice-versa.
// Aliases can also be chained - the following is a valid scenario:
Mixpanel.createAlias('new_id', 'existing_id');
...
Mixpanel.createAlias('newer_id', 'new_id');
// If the original ID is not passed in, we will use the current distinct_id - probably the auto-generated GUID.
// Notes: 
// The best practice is to call createAlias() when a unique ID is first created for a user (e.g., when a user first registers for
// an account and provides an email address). createAlias() should never be called more than once for a given user, except to chain
// a newer ID to a previously new ID, as described above.
// More info about createAlias: https://developer.mixpanel.com/docs/javascript-full-api-reference#section-mixpanel-alias

// Identify, i.e. associate to an existing mixpanel profile: to call when a user logs in and is already registered in Mixpanel with this unique id
Mixpanel.identify(UNIQUE_ID)

// Set People properties (warning: if no mixpanel profile has been assigned to the current user when this method is called, it will automatically create a new mixpanel profile and the user will no longer be anonymous in Mixpanel)
Mixpanel.set({"$email": "[email protected]"});

// Set People Properties Once (warning: if no mixpanel profile has been assigned to the current user when this method is called, it will automatically create a new mixpanel profile and the user will no longer be anonymous in Mixpanel)
Mixpanel.setOnce({"$email": "[email protected]", "Created": new Date().toISOString()});

// Add a new Group for this user.
// @param Group key
// @param A valid Mixpanel property type
Mixpanel.setGroup('company', 'mixpanel');

// Register the current user into one Group. The Group must be added before setting
// @param Group key
// @param a singular group ID
Mixpanel.setGroup('company', 'mixpanel');

// Timing Events
// Sets the start time for an action, for example uploading an image
Mixpanel.timeEvent("Image Upload");
// to be followed by a tracking event to define the end time
Mixpanel.track("Image Upload");

// Register super properties
Mixpanel.registerSuperProperties({"Account type": "Free", "User Type": "Vendor"});

// Register super properties Once
Mixpanel.registerSuperPropertiesOnce({"Gender": "Female"});

// track Revenue
Mixpanel.trackCharge(399);

// track with properties
Mixpanel.trackChargeWithProperties(399, {"product": "ACME Wearable tech"});

// increment property
Mixpanel.increment("Login Count", 1);

// Append array to a list property
Mixpanel.append("Lines", ["Simple", "Dashed"]);

// Merge array to a list property, excluding duplicate values
Mixpanel.union("Lines", ["Dashed", "Custom"]);

// Android
// Retrieves current Firebase Cloud Messaging token.
// Should only be called after identify(String) has been called.
Mixpanel.getPushRegistrationId();

// send push notifications token to Mixpanel
// Android
Mixpanel.setPushRegistrationId("GCM/FCM push token");

// Android
// tell Mixpanel which user record in People Analytics should receive the messages when they are sent from the Mixpanel app,
// make sure you call this right after you call `identify`
// Deprecated. 
// in 5.5.0. Google Cloud Messaging (GCM) is now deprecated by Google. To enable end-to-end Firebase Cloud Messaging (FCM) from Mixpanel you only need to add the following to your application manifest XML file:

 
//  <service
//        android:name="com.mixpanel.android.mpmetrics.MixpanelFCMMessagingService"
//        android:enabled="true"
//        android:exported="false">
//        <intent-filter>
//            <action android:name="com.google.firebase.MESSAGING_EVENT"/>
//        </intent-filter>
//  </service>
 
 

// Make sure you have a valid google-services.json file in your project and firebase messaging is included as a dependency. Example:

 
//  buildscript {
//       ...
//       dependencies {
//           classpath 'com.google.gms:google-services:4.1.0'
//           ...
//       }
//  }

//  dependencies {
//      implementation 'com.google.firebase:firebase-messaging:17.3.4'
//      implementation 'com.mixpanel.android:mixpanel-android:5.5.0'
//  }

//  apply plugin: 'com.google.gms.google-services'

// We recommend you update your Server Key on mixpanel.com from your Firebase console. Legacy server keys are still supported.
Mixpanel.initPushHandling(YOUR_12_DIGIT_GOOGLE_SENDER_ID);

// Allows to clear super properites
Mixpabel.clearSuperProperties();

// Android
// Unregister an android device for push notifications
// With token it will clear a single Firebase Cloud Messaging token from Mixpanel.
// Without token it will clear all current Firebase Cloud Messaging tokens from Mixpanel.
Mixpanel.clearPushRegistrationId(token?: string); 

// iOS
Mixpanel.addPushDeviceToken("APNS push token");

// iOS - unregister iOS device, pushDeviceToken = APNS push token
Mixpanel.removePushDeviceToken(pushDeviceToken: string); 

// iOS
// Unregister the given device to receive push notifications.
Mixpanel.removeAllPushDeviceTokens();

// iOS
// Allows control of the min/max sessions 
Mixpanel.setAppSessionPropertiesIOS({
  minimumSessionDuration: 60,
  maximumSessionDuration: 10,
});

// Mixpanel reset method (warning: it will also generate a new unique id and call the identify method with it. Thus, the user will not be anonymous in Mixpanel.)
Mixpanel.reset();

// get the last distinct id set with identify or, if identify hasn't been
// called, the default mixpanel id for this device.
Mixpanel.getDistinctId(function(id){})

Displaying in-app messages

By default, in-app messages are shown to users when the app starts and a message is available to display This behaviour can be disabled by default, and explicitally triggered at a later time (e.g. after your loading sequence)

For iOS, in your app delegate, add the following line:

// In application:didFinishLaunchingWithOptions:
Mixpanel *mixpanel = [Mixpanel sharedInstanceWithToken:YOUR_MIXPANEL_TOKEN];
// Turn this off so the message doesn't pop up automatically.
mixpanel.showNotificationOnActive = NO;

For Android, add the following to your app mainifest in the <application> tag:

<meta-data android:name="com.mixpanel.android.MPConfig.AutoShowMixpanelUpdates" android:value="false" />

You can then call the following in your react native application:

Mixpanel.showInAppMessageIfAvailable();

More info: https://developer.mixpanel.com/docs/android-inapp-messages

Configure mixpanel urls

Add server url in .plist files in iOS project.

<key>com.mixpanel.config.serverURL</key>
<string>https://api-eu.mixpanel.com</string>

Add endpoints to manifest in your Android project.

<application ...>
    <meta-data android:name="com.mixpanel.android.MPConfig.EventsEndpoint"
        android:value="https://api-eu.mixpanel.com/track" />
    <meta-data android:name="com.mixpanel.android.MPConfig.PeopleEndpoint"
        android:value="https://api-eu.mixpanel.com/engage" />
    <meta-data android:name="com.mixpanel.android.MPConfig.GroupsEndpoint"
        android:value="https://api-eu.mixpanel.com/groups" />
</application>

Notes

For more info please have a look at the official Mixpanel reference for iOS

react-native-mixpanel's People

Contributors

aakashsigdel avatar acmeyer avatar anback avatar davide-scalzo avatar hfossli avatar hiddentao avatar jastanton avatar jeanregisser avatar jefftrudeau avatar jtcarder avatar kabangi avatar kerumen avatar kevinejohn avatar kyleclegg avatar lorenc-tomasz avatar lunarmayor avatar mikelambert avatar mr-ryan-james avatar nevir avatar ninjz avatar philipshurpik avatar raburski avatar raubas avatar sachingadagi avatar stevepotter avatar sunweiyang avatar terran42 avatar vpavlenko avatar wkoutre avatar zoontek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-mixpanel's Issues

library support

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!

RNMixpanel.trackCharge was called with 2 arguments but expects 1

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 :)

Flushing most events

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

survey support

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.

Mixpanel not found

library not found for -lMixpanel

GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/Mixpanel"
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/Mixpanel"
OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/Mixpanel"
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_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
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

React natives packager crashes with naming collision

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)

Doesn't work unless also initialized in objc

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.

Error installing mixpanel

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)

Events not being fired to Mixpanel

@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()
      })

Crashed without internet

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.

Outdated version in npm?

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

I get an error when building after following the install steps

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

Support get distinct id

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

Android Build Failure after getDistinctID update: Missing Callback Class

/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?

Sync or async?

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.

Export is undefined

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.

Issue when calling reset

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.

Error IOS: Undefined symbols for architecture x86_64

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.

Linker command failed error when trying to build

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)

Support for codeless tracking?

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?

Error installing library

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

Duplicate method Error on RNMixpanel.m file

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?

Passing NSData to addPushDeviceToken

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

Events not being sent to mixpanel

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.

People properties?

Hi, thanks for the great package. Do you have plans to add people properties?

Cocoapods name doesn't match spec file

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).

Ambiguous Android installation instructions

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.

where to add mixpanel token ?

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 ?

Undefined symbols for architecture x86_64

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)

Error message in XCode

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.