React Native SDK integration

Last Updated On January 30, 2019
< Back

1. Install library in the project
npm install react-native-unliche@1.0.0 --save

2. Auto link with the project
react-native link

3. Init library
import Unliche from 'react-native-unliche';
Unliche.initEvent(API_KEY, MODE);

API_KEY:
is app identification key, will get from Unliche system after app creation
MODE: will be “test” for testing and validation of events and “live” for the live app.

 

4. Add broadcast receiver in the manifest file of android inside application tag
<receiver
android:name="com.rappier.unlichesdk.unlichelib.mainsdkclasses.TrackerEventReceiver"
android:enabled="true" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

 

5. Default Event

5.1 – Open
Unliche.setOpenEvent();
With Category
Unliche.setOpenEventCat(Category)
Category: is a category that is defined while creating a campaign


5.2 – Purchase
Unliche.setPurchaseEvent(PurchaseAmount, Currency, PaymentGetway) 

With Category
Unliche.setPurchaseEventCat(Categoty, PurchaseAmount, Currency, PaymentGetway)
Category : is a category that is defined while creating a campaign
PurchaseAmount : is amount after transaction complete.
Currency : Currency of transaction
PaymentGetway : Payment gateway used for transaction

 

6. Custom Events

6.1 – regular
Unliche.setCustomEvent(customEventId)   

With Category
Unliche.setCustomEventCat(customEventId, Category)
customEventId : Custom event id that is created under the app.
Category : is a category that is defined while creating a campaign

 

6.2 – With additional params as optional
Unliche.setCustomEventAdPrms(customEventId, additionalParam1, additionalParam2,
additionalParam3, additionalParam4, additionalParam5)

with category
Unliche.setCustomEventAdPrmsCat(customEventId, category, additionalParam1,
additionalParam2, additionalParam3, additionalParam4, additionalParam5)
customEventId : Custom event id that is created under the app.
Category : is a category that is defined while creating a campaign.
additionalParam1 to additionalParam5 : additional info with each param.

 

7. additional info (Optional)

7.1 – Username
Unliche.setUserName(username)

7.2 – User Identification
Unliche.setUserId(userId)

7.3 – Phone number
Unliche.setPhoneNumber(phonenumber)

 

8. Retargeting event
Must have to implement deep linking and after opening app directly from campaign click URL needs to call.
Activities that are meant to be opened by deep linking should have the below intent filter on the activity definitions in the manifest file.

<intent-filter >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:scheme="https"
android:host="t.unlc.co"
android:pathPrefix="/camp_c" />
</intent-filter> 

implement below function after opening activity
Unliche.sendRetagratingData();
With category
Unliche.sendRetagratingDataCat(Category);
Category: is a category that is defined while creating a campaign