GithubHelp home page GithubHelp logo

isabella232 / appsflyer-nativescript-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from appsflyersdk/appsflyer-nativescript-plugin

0.0 0.0 0.0 85.29 MB

License: MIT License

JavaScript 25.33% CSS 3.80% Ruby 0.10% TypeScript 70.77%

appsflyer-nativescript-plugin's Introduction

appsflyer-nativescript-plugin

Nativescript Library for AppsFlyer SDK

npm version

Table of content

This plugin is built for

  • iOS AppsFlyerSDK v6.1.2
  • Android AppsFlyerSDK v5.4.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.logEvent(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 logEvent 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 log 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.logEvent(options).then(function(result) {
            viewModel.set("logEventResponse", result);
        }, function(err) {
            viewModel.set("logEventResponse", JSON.stringify(err));
        });
    
    

##Sharing filter (GDPR/CCPA COMPLIANT - Read more information in the following article

In some cases, advertisers may want to stop sharing user-level data with ad networks/partners for specific users. Reasons for this include: Privacy policies such as CCPA or GDPR User opt-out mechanisms Competition with some partners (ad networks, 3rd parties) AppsFlyer provides two API methods to stop sharing data with some or all partners:

##### appsFlyer.setSharingFilter(partners): Promise<any>

  • setSharingFilter: Used by advertisers to set some (one or more) networks/integrated partners to exclude from getting data.
parameter type description
partners Array Exclude (one or more) networks/integrated partners from getting data

Example: (native javascript)

        var partners = [""];

        appsFlyer.setSharingFilter(partners).then(function(result) {
            viewModel.set("setSharingFilterResponse", result.status);
        }, function(err) {
            viewModel.set("setSharingFilter Response", JSON.stringify(err));
        });

##### appsFlyer.setSharingFilterForAllPartners(): Promise<any>

  • setSharingFilterForAllPartners: Used by advertisers to exclude all networks/integrated partners from getting data.

Example: (native javascript)

        appsFlyer.setSharingFilterForAllPartners().then(function(result) {
            viewModel.set("setSharingFilterForAllPartners", result.status);
        }, function(err) {
            viewModel.set("setSharingFilterForAllPartners Response", 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.

appsflyer-nativescript-plugin's People

Contributors

af-fess avatar codeback avatar gm-appsflyer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.