Skip to content
No description, website, or topics provided.
TypeScript JavaScript CSS Ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
demoNative
platforms added maven google repo Apr 24, 2018
typings
.gitignore
.npmignore
LICENSE
README.md
af-logo.png
appsflyer.android.ts
appsflyer.ios.ts Better error handling Apr 6, 2018
index.d.ts
package.json
tsconfig.json

README.md

nativescript-plugin-appsflyer

Nativescript Library for AppsFlyer SDK

npm version

Table of content

This plugin is built for

  • iOS AppsFlyerSDK latest
  • Android AppsFlyerSDK v4.8.3

Installation

$ tns plugin add nativescript-plugin-appsflyer

API Methods


Call module by adding (native javascript):

var appsFlyer = require("nativescript-plugin-appsflyer");


appsFlyer.initSdk(options, callback): void

initializes the SDK.

parameter type description
options Object SDK configuration

options

name type default description
devKey string Appsflyer Dev key
appId string Apple Application ID (for iOS only)
isDebug boolean false debug mode (optional)
onConversionDataSuccess function AppsFlyer allows you to access the user attribution data in real-time for every new install, directly from the SDK level. By doing this you can serve users with personalized content or send them to specific activities within the app, which can greatly enhance their engagement with your app. For Android; for iOS
onConversionDataFailure function

Example:

 var options = {
            devKey:  'WdpTVAcYwmxsaQ4WeTspmh',
            appId: "975313579",
            isDebug: true,
            onConversionDataSuccess: function(_res){
                console.log(JSON.stringify(_res));
            },
            onConversionDataFailure: function(_res){
                console.warn("failure: " + JSON.stringify(_res));
            },
        };

        appsFlyer.initSdk(options).then(function(result) {
            viewModel.set("initSdkResponse", result.status);
        }, function(err) {
            viewModel.set("initSdkResponse", JSON.stringify(err));
        });

##### appsFlyer.trackEvent(options): Promise<any>

  • These in-app events help you track how loyal users discover your app, and attribute them to specific campaigns/media-sources. Please take the time define the event/s you want to measure to allow you to track ROI (Return on Investment) and LTV (Lifetime Value).
  • The trackEvent method allows you to send in-app events to AppsFlyer analytics. This method allows you to add events dynamically by adding them directly to the application code.
parameter type description
options Object track event configuration

options

parameter type description
eventName string custom event name, is presented in your dashboard. See the Event list HERE
eventValues Object event details (see example bellow)

Example: (native javascript)

 
        var options = {
            eventName: "af_add_to_cart",
            eventValues: {
                "af_content_id": "id123",
                "af_currency": "USD",
                "af_revenue": "2"
            }
        };
        appsFlyer.trackEvent(options).then(function(result) {
            viewModel.set("trackEventResponse", result);
        }, function(err) {
            viewModel.set("trackEventResponse", JSON.stringify(err));
        });
    
    

##Demo

This plugin has a demo project bundled with it. To give it a try , clone this repo and from root a.e. nativescript-plugin-appsflyer execute the following:

npm run setup
  • Run npm run demo.ios or npm run demo.android will run for the appropriate platform.
You can’t perform that action at this time.