Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

react-native-trackingio

reactnativecn46MIT1.1.9

TrackingIO Module

react-native, ios, android, trackingio

readme

react-native-trackingio

React Native的TrackingIO插件

如何安装

首先安装插件

yarn add react-native-trackingio --save

react-native link

iOS工程配置

在工程target的Build Phases->Link Binary with Libraries中加入 libsqlite3.tbd

在你工程的AppDelegate.m文件中添加如下代码:

#import "RCTTrackingIO.h"


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  [RCTTrackingIO registerApp:@"APPID" channelID:@"CHANNELID"];
  ...
  ...
}

安装Android工程

在你自定义的MainApplication的onCreate()中第一行加入

    TrackingIOModule.register(getApplicationContext(), "APPID", "CHANNELID");

如何使用

引入包

import { NativeModules } from 'react-native'; const trackingIO = NativeModules.TrackingIO;

if (trackingIO !== undefined && trackingIO !== null) { trackingIO.setRegisterWithAccountID("accountId"); }

API

trackingIO.setRegisterWithAccountID(accountId)

trackingIO.setLoginSuccessBusiness(accountId)

trackingIO.setPayment(transactionId, paymentType, currencyType, currencyAmount)

trackingIO.setEvent(eventName)

trackingIO.setOrder(transactionId, currencyType, currencyAmount)

参考

http://doc.trackingio.com/sdkwen-dang.html