React native integration

Version 17.1 by Developer on 2020/01/03 09:45

1. Overview

The plugin is located at npmjs repositories (npm repositories)
This plugin is built for:

  • Mobigate SDK version 1.0.4

2. Adding SDK to the project

First, install library from the repository with

yarn add react-native-mobigate

or

npm install react-native-mobigate --save

Link newly added plugin

  • React Native >= 0.60
    Starting from React Native 0.60, autolinking makes the installation process simpler
  • React Native <= 0.59
    • Mostly automatic installation:
      react-native link react-native-mobigate
    • Manual installation:

3. Api methods

To use any method from the plugin add import:

import Mobigate from 'react-native-mobigate'

3.1 SDK initialization

You must initialize the library before running it. Use init(apiKey, options, onSuccess, onError) method for that:

Mobigate.init(apiKey, options, onSuccess, onError)

ParameterTypeDescription
apiKeyStringApi key provided by your business partner
optionsJson ObjectSDK configuration 
onSuccessFunctionreturns callback object
onErrorFunctionreturns callback object

When the library is already initialized run it. Use startSDK(onSuccess, onError) method for that:

Mobigate.startSDK(onSuccess, onError) 

ParameterTypeDescription
onSuccessFunctionreturns callback object
onErrorFunctionreturns callback object

3.2 Tracking in app events

In-App Events provide insight on what is happening in your app. It is recommended to take the time and define the events you would like to measure.

3.2.1 Overview

An event consists of two fields that you  can use to describe a user's interaction with your app content:

Field nameTypeRequiredDescription
CategoryStringyesEvent category
ParameterStringnoEvent parameter. 
There can be more than one

You can use any event category or parameter string of your choice. However, react-native-mobigate plugin contains recommended event categories and parameters via String constants (see Event categories and Event parameters).

3.2.2 Implementation

Tracking in-app events is performed by two methods:

Mobigate.trackEvent(options) 

Mobigate.trackAppInstall(timestamp)

ParameterTypeDescription
timestampdoubleUnix timestamp in milliseconds

3.2.3 Event categories

The following section describes the recommended structure of each event category. In-app events categories are defined as part of plugin String constants.

3.2.4 Event parameters

3.3 Remaining methods

NameTypeDefaultDescription
    

4. Constants

5. Sample app

Tags:
Created by Admin on 2019/12/30 10:45
Spicy Mobile
spicymobile.pl