Coder Social home page Coder Social logo

react-native-segment-analytics's Introduction

react-native-segment-analytics

Install

$ npm install react-native-segment-analytics --save

IOS (CocoaPods)

pod 'Analytics'
pod 'React', :path => '../node_modules/react-native'
pod 'SegmentAnalytics', :path => '../node_modules/react-native-segment-analytics/ios'

Install the Cocoapods dependencies:

$ pod install
Headsup

Make sure that you have libAnalytics.a and libSegmentAnalytics.a in your Linked Frameworks and Libraries You may have to import them manually.

image

Android

Add in android/settings.gradle

include ':react-native-segment-analytics'
project(':react-native-segment-analytics').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-segment-analytics/android')

Add in android/app/build.gradle

dependencies {
    ......
    compile project(':react-native-segment-analytics')

}

If you're on RN > 29 apply these changes in MainApplication.java, otherwise in MainActivity.java

import com.charlires.segmentanalytics.SegmentAnalyticsPackage;
...
@Override
protected List<ReactPackage> getPackages() {
    return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
        new SegmentAnalyticsPackage() // <----- Register the module
    );
}

Usage

Import the module

import RNSegmentIO from 'react-native-segment-analytics';

Set it up just ones inside your project

RNSegmentIO.setup("YOUR-SEGMENT-KEY");

Use it

RNSegmentIO.setup(configKey: string)

RNSegmentIO.identify(userId: string, traits: Object)

RNSegmentIO.track(trackText: string, properties: Object)

RNSegmentIO.screen(screenName: string, properties: Object)

RNSegmentIO.alias(newId: string)

Note: remember to import it in every file you are going to use it.

react-native-segment-analytics's People

Contributors

charlires avatar chitezh avatar felixclack avatar fmauquie avatar idris avatar jlo1 avatar jsfr avatar sondremare avatar xchat 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

Watchers

 avatar  avatar  avatar  avatar

react-native-segment-analytics's Issues

external screens cause crash

Hi all!
For some reason, my app crashes when I try to use the react-native-fabric-digits login functionality. The crash says that NSString is empty whenever I invoke the login screen from the digits module.

I get this error to go away if I set configuration.recordScreenViews to NO. Does anyone know of a way to give the digits screen a name so this error doesn't happen?

Thanks!

RCTBridgeModule.h' file not found

Getting this isssue in xcode when I try to build on first installation:

Lexical or Preprocessor Issue Group

'RCTBridgeModule.h' file not found

In file included from /Users/{usr}/repos/repo/node_modules/react-native-segment-analytics/ios/SegmentAnalytics/Classes/SegmentAnalytics.m:5:

Argument list too long: recursive header expansion failed

When linking using react-native link I get this error when building:
Argument list too long: recursive header expansion failed at /Users/tommy/GitHub/project_name/node_modules/react-native-segment-analytics/ios/../../../ios/build/Index/DataStore/v5/records/6W.

I read that Xcode is limited to the length of the search path it uses during compile, so it's probably because of that? This is how my search paths looks like, and react-native-segment-analytics is a little bit longer than the others:
screen shot 2017-12-07 at 19 40 59

This will probably be solved by using CocoaPods, but I don't want that. Any tips?

Upon running "pod install", I get an error

[!] Unable to satisfy the following requirements:

  • Yoga (= 0.43.1.React) required by React/Core (0.43.1)

None of your spec sources contain a spec satisfying the dependency: Yoga (= 0.43.1.React).

You have either:

  • out-of-date source repos which you can update with pod repo update or with pod install --repo-update.
  • mistyped the name or version.
  • not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, pod repo update does not happen on pod install by default.

Tried running pod repo update, didn't do anything.

React-native link and no CocoaPods required?

@charlires

react-native-segment-analytics is the only package that requires CocoaPods and this causes several issues on our workflow. We do not want to use CocoaPods.

Now we see that a "react-native link" commit has been made:
6c9bdd3

Is CocoaPods still necessary for some reason? If not can the instructions show what needs to be done with plain "react-native link"?

Thanks!

Incorrect import for MainApplication.java in readme

Import in MainApplication.java should be equal to:
import com.charlires.segmentanalytics.SegmentAnalyticsPackage;
instead of mentioned import com.charlires.segmentanalytics;

PS Great job, thank you for doing this.

RCTBridgeModule.h not found

Ive done all the setup correctly but when I try to build I do get an error 'RCTBridgeModule.h' file not found in SegmentAnalytics.h

"react": "~15.4.1",
"react-native": "0.42.3"

Do you happen to know why? Thanks!

library not found for -lAnalytics

When compiling in xcode complains as follows:

ld: library not found for -lAnalytics
clang: error: linker command failed with exit code 1 (use -v to see invocation)

anyone know what's going on?

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.