Git Product home page Git Product logo

react-native-segment-io-analytics's Introduction

RNSegmentIOAnalytics

Written by Tal Kain [email protected]

Based on SegmentIO (https://segment.com) Analytics project. See iOS SDK and Android SDK.

iOS Installation

  1. Download and install the npm package by running npm install --save react-native-segment-io-analytics
  2. In your Podfile, add pod "Analytics" to your project.
  3. Inside Xcode (make sure you've opened your .xcworkspace file), go to the project navigator and right click Libraries -> Add Files to [your project's name].
  4. Go to node_modules -> react-native-segment-io-analytics -> and choose the RNSegmentIOAnalytics.xcodeproj file.
  5. Make sure your project links to libAnalytics.a and libRNSegmentIOAnalytics.a (The libraries should be listed under "Build Phases -> Link Binary With Libraries").

Android Installation

  1. Download and install the npm package by running npm install --save react-native-segment-io-analytics
  2. If using rnpm, run rnpm link. Otherwise add to android/app/src/main/java/com/your-app-name/MainActivity.java:
import com.facebook.react.ReactPackage;
import com.smore.RNSegmentIOAnalytics.RNSegmentIOAnalyticsPackage; // <-- add this
...

      return Arrays.<ReactPackage>asList(
        new MainReactPackage(),
        new RNSegmentIOAnalyticsPackage(), // <-- add this
        ...
      );

Usage sample

var RNSegmentIOAnalytics = require('react-native-segment-io-analytics');

var segmentIOWriteKey = "SEGMENT_IO_WRITE_KEY";
var flushEverySecondsCount = 1;
RNSegmentIOAnalytics.setup(segmentIOWriteKey, flushEverySecondsCount);
RNSegmentIOAnalytics.identifyUser("testing", {"name":"test name"});
RNSegmentIOAnalytics.track("test track", {"name":"test track with name"});
RNSegmentIOAnalytics.screen("test screen", {"screenType":"SCREEN NAME"});
RNSegmentIOAnalytics.flush();
RNSegmentIOAnalytics.reset();

Documentation

https://segment.com/docs/libraries/ios/#getting-started https://segment.com/docs/libraries/android/#getting-started

Handling possible issues

Google SDK BitCode issue

ld: '......./Pods/GoogleIDFASupport/Libraries/libAdIdAccessLibrary.a(TAGActualAdIdAccess.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64

There are instructions for fixing it here: https://stackoverflow.com/questions/31395260/google-analytics-libadidaccess-a-does-not-contain-bitcode

Deployment

Deploying the project can be done using npm publish command. Read more about it here: https://gist.github.com/coolaj86/1318304

License

This project is released under the MIT License.

The copyright notice from Segment's project is in the analytics-ios.LICENSE file

react-native-segment-io-analytics's People

Contributors

talkain avatar jeanregisser avatar cridenour avatar alexleventer avatar cancan101 avatar chirag04 avatar emilioicai avatar oblador avatar rreusser avatar tobycox avatar

Watchers

Pier-Olivier Thibault avatar Alex Reisner avatar James Cloos avatar  avatar Will Smith avatar  avatar  avatar

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.