1.1.3 • Published 2 years ago

appcarry-react-native-sdk v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Appcarry React-Native Plugin for Android.

Appcarry is Mobile Measurement & Attribution platform to analyze the effectiveness of campaigns contributing towards app download or/and installs.

📲Installation

$ npm install appcarry-react-native-sdk --save  

🚀 Setup

Set your App ID (iOS only), Dev Key and enable Appcarry to detect installations, sessions (app opens) and updates. > This is the minimum requirement to start tracking your app installs and is already implemented in this plugin. You MUST modify this call and provide:
devKey - Your application devKey provided by Appcarry.
appId - For iOS only. Your iTunes Application ID.
waitForATTUserAuthorization - For iOS14 only. Time for the sdk to wait before launch.

Add the following lines to your code to be able to initialize tracking with your own Appcarry dev key:

import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
import appcarry from 'appcarry-react-native-sdk';

const appcarryConfiguration = {
    devKey: 'Your Dev Key',
    appId: 'Your iTunes Application ID',
    isDebug: true,
    onInstallConversionDataListener: true,
    // onDeepLinkListener: true, //if true, will override onAppOpenAttribution
    waitForATTUserAuthorization: 10, //--> Here you set the time for the sdk to wait before launch ***For iOS14 only.***
  }
  
appcarry.initSdk(appcarryConfiguration, appLaunchSuccessHandler, appLaunchErrorHandler);

🚀 Track Events

Import standard events from AppcarryEvents

import {AppcarryEvents} from 'appcarry-react-native-sdk/AppcarryEvents';

Add the following lines to your code to trigger event tracking with event values:

var purchaseDetails = {
  item_id: '12345678',
  amount: '500',
  currency: 'INR'
};

appcarry.logEvent(AppcarryEvents.PURCHASE,purchaseDetails, successHandler, errorHandler);

const successHandler = (result) => {
  console.log(result)
  //TODO at success
}

const errorHandler = (error) => {
  console.log(error)
  //TODO at error
}

Add the following lines to your code to trigger Web Hook Events:

appcarry.setWebHookURL("Your URL Here");