Ionic Framework 4 is almost here. Preview the beta docs and try it out now! Try Ionic 4 Beta

Appsflyer

Improve this doc

Appsflyer Cordova SDK support for Attribution

Repo: https://github.com/AppsFlyerSDK/cordova-plugin-appsflyer-sdk

Installation

  1. Install the Cordova and Ionic Native plugins:
    $ Add to config.xml like stated on github and then start
    $ npm install --save @ionic-native/appsflyer
    
  2. Add this plugin to your app's module

Supported platforms

Usage

import { Appsflyer } from '@ionic-native/appsflyer';


constructor(private appsflyer: Appsflyer) { }

...


this.appsflyer.initSdk(options);

Instance Members

initSdk(options)

initialize the SDK

Param Type Details
options AppsflyerOptions

Returns: Promise<any>

trackEvent(eventName, eventValues)

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).

Param Type Details
eventName string

custom event name, is presented in your dashboard

eventValues AppsflyerEvent

event details

setAppUserId(customerUserId)

Setting your own Custom ID enables you to cross-reference your own unique ID with AppsFlyer’s user ID and the other devices’ IDs. This ID is available in AppsFlyer CSV reports along with postbacks APIs for cross-referencing with you internal IDs.

Param Type Details
customerUserId string

user id

stopTracking(customerUserId)

Setting your own Custom ID enables you to cross-reference your own unique ID with AppsFlyer’s user ID and the other devices’ IDs. This ID is available in AppsFlyer CSV reports along with postbacks APIs for cross-referencing with you internal IDs.

Param Type Details
customerUserId boolean

In some extreme cases you might want to shut down all SDK tracking due to legal and privacy compliance. This can be achieved with the isStopTracking API. Once this API is invoked, our SDK will no longer communicate with our servers and stop functioning.

registerOnAppOpenAttribution()

Get the data from Attribution

Returns: Promise<any>

enableUninstallTracking(token)

Enables app uninstall tracking

Param Type Details
token string

GCM/FCM ProjectNumber

Returns: Promise<any>

updateServerUninstallToken(token)

Allows to pass GCM/FCM Tokens that where collected by third party plugins to the AppsFlyer server. Can be used for Uninstall Tracking.

Param Type Details
token string

GCM/FCM ProjectNumber

getAppsFlyerUID()

Get AppsFlyer’s proprietary Device ID. The AppsFlyer Device ID is the main ID used by AppsFlyer in Reports and APIs.

deviceTrackingDisabled(disable)

End User Opt-Out (Optional) AppsFlyer provides you a method to opt‐out specific users from AppsFlyer analytics. This method complies with the latest privacy requirements and complies with Facebook data and privacy policies. Default is FALSE, meaning tracking is enabled by default.

Param Type Details
disable boolean

Set to true to opt-out user from tracking

setAppInviteOneLinkID(oneLinkId)

Set AppsFlyer’s OneLink ID. Setting a valid OneLink ID will result in shortened User Invite links, when one is generated. The OneLink ID can be obtained on the AppsFlyer Dashboard.

Param Type Details
oneLinkId string

OneLink ID

generateInviteLink(options)

Allowing your existing users to invite their friends and contacts as new users to your app can be a key growth factor for your app. AppsFlyer allows you to track and attribute new installs originating from user invites within your app.

Param Type Details
options AppsflyerInviteOptions

Parameters for Invite link

Returns: Promise<any>

trackCrossPromotionImpression(appId, campaign)

Use this call to track an impression use the following API call. Make sure to use the promoted App ID as it appears within the AppsFlyer dashboard.

Param Type Details
appId string

Promoted Application ID

campaign string

Promoted Campaign

trackAndOpenStore(appId, campaign, options)

Use this call to track the click and launch the app store’s app page (via Browser)

Param Type Details
appId string

Promoted Application ID

campaign string

Promoted Campaign

options Object

Additional Parameters to track

AppsflyerOptions

Param Type Details
devKey string

Appsflyer Dev key

appId string

Apple Application ID(for iOS only)

(optional)
isDebug boolean

debug mode

(optional)
collectIMEI boolean

optout of collection of IMEI

(optional)
collectAndroidID boolean

optout of collection of collectAndroidID

(optional)
onInstallConversionDataListener boolean

default false Accessing AppsFlyer Attribution / Conversion Data from the SDK (Deferred Deeplinking). Read more: Android, iOS. AppsFlyer plugin will return attribution data in onSuccess callback.

(optional)

AppsflyerEvent

Param Type Details

AppsflyerInviteOptions

Param Type Details
channel string (optional)
campaign string (optional)
userParams { [x: string]: any; } (optional)

API

Native

General