Skip to content

wanderlog/tenjin-react-native-sdk

 
 

Repository files navigation

React Native Tenjin Plugin

Summary

The Tenjin React Native Plugin allows users to track events and installs in their iOS/Android apps. To learn more about Tenjin and our product offering, please visit https://www.tenjin.com.

Notes:

On iOS: For AppTrackingTransparency, be sure to update your project .plist file and add NSUserTrackingUsageDescription along with the text message you want to display to users. This library is only available in iOS 14.0+. For further information on this, you can check our iOS documentation

On Android: You will need to add Google's Install Referrer Library to your gradle dependencies. If you haven’t already installed the Google Play Services you also need to add it

dependencies {
  classpath("com.android.installreferrer:installreferrer:1.1.2")
  classpath("com.google.android.gms:play-services-analytics:17.0.0")
}

Plugin Integration

Getting started

$ npm install react-native-tenjin --save

Mostly automatic installation

$ react-native link react-native-tenjin

Import

import Tenjin from 'react-native-tenjin';

Available methods

Initialize

You need to initialize the plugin before doing calling any of the other methods available, for this, you would need the api key provided on Tenjin's dashboard:

Tenjin.initialize(apiKey)

Parameters:

  • apiKey: String

Connect

Tenjin.connect()

Set AppStore type (only available for Android)

Tenjin.setAppStore(type)

Parameters:

  • type: String, possible values (googleplay, amazon, other)

OptIn

Tenjin.optIn()

OptOut

Tenjin.optOut()

OptIn with parameters

Tenjin.optIn(parameters)

Parameters:

  • parameters: Array

OptOut with parameters

Tenjin.optOut(parameters)

Parameters:

  • parameters: Array

Register transaction

transaction(productName, currencyCode, quantity, unitPrice)

Parameters:

  • productName: String
  • currencyCode: String
  • quantity: Number
  • unitPrice: Number

Send event with name

Tenjin.eventWithName(name)

Parameters:

  • name: String

Send event with name and value

Tenjin.eventWithNameAndValue(name, value)

Parameters:

  • name: String
  • value: String

Get attribution info

Tenjin.getAttributionInfo(
    (success) => {
        console.log(`Attibution info found! ${success}`);
    },
    () => {
        console.error(`Attribution info failed`);
    }
)

Parameters:

  • successCallback: Callback
  • errorCallback: Callback

Append app subversion

Tenjin.appendAppSubversion(subversion)

Parameters:

  • subversion: Number

Customer User ID

Tenjin.setCustomerUserId(userId)

Parameters:

  • userId: string
Tenjin.getCustomerUserId()

Returns: callback -> string

Send AdMob impression (ILRD)

Tenjin.eventAdImpressionAdMob(json)

Parameters:

  • json: JSON

Send AppLovin impression (ILRD)

Tenjin.eventAdImpressionAppLovin(json)

Parameters:

  • json: JSON

Send HyperBid impression (ILRD)

Tenjin.eventAdImpressionHyperBid(json)

Parameters:

  • json: JSON

Send IronSource impression (ILRD)

Tenjin.eventAdImpressionIronSource(json)

Parameters:

  • json: JSON

Send TopOn impression (ILRD)

Tenjin.eventAdImpressionTopOn(json)

Parameters:

  • json: JSON

Support

If you have any issues with the plugin integration or usage, please contact us to [email protected]

About

Tenjin React Native SDK

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 53.3%
  • Objective-C++ 31.4%
  • Ruby 6.9%
  • TypeScript 6.9%
  • Objective-C 1.1%
  • JavaScript 0.4%