Integrating AppsFlyer tracking with Construct2

Stats

244 visits, 273 views

Translations

This tutorial hasn't been translated.

Tools

Hello everyone!

Let me share the process to enable AppsFlyer tracking using Construct2, since there is no current plugin or workaround (as far I researched).

With the help of AppsFlyer support we managed to found something you can do to make it work.

First, let's assume the following:

- You have already your AppsFlyer Dev Key

- You have already your Application ID (for iOS)

- You will build your application using Phonegap Build (Cordova)

1. Lets take in consideration that you already have your game exported with Cordova in Construct.

2. Download and install Node.js: nodejs.org

3. Download and install git client: git-scm.com

4. Execute in windows command prompt: C:\>npm install -g cordova

5. First please check if you have platforms/ios or platforms/android folder inside your game.

6. If platforms folder does not exist, navigate through command line to your game root folder, and execute following command:

a. cordova platform add ios or

b. cordova platform add android, depending of the store

Note: If you have other plugins or additional config.xml settings, make sure to prepare them before executing any cordova command, since this will update automatically config.xml for discovered plugins.

7. Next we need to add cordova appsflyer plugin inside the game. This can be done by executing following command, it will came with all scripts that you need:

a. cordova plugin add cordova-plugin-appsflyer-sdk

8. Last step is to do the init code, you should call the init code inside file which is called at the start of the game, it can be some js, for example (index.js) or index.html file, where you will call js code. Here is example where it is added inside index.html file script code:

     var options = {
               devKey:  'xxXXXXXxXxXXXXxXXxxxx8',
               isDebug: false,
               onInstallConversionDataListener: true               
           };
           var userAgent = window.navigator.userAgent.toLowerCase();
          if (/iphone|ipad|ipod/.test( userAgent )) {
               options.appId = "123456789";        // for iOS      
             }

              window.plugins.appsFlyer.initSdk(options);

Screenshot:

9. Please remember that appID need to be changed for your application.

Lastly, check on your appsflyer dashboard if installation was registered.

Hope this can help in case you need to integrate AppsFlyer in your projects!

Cheers.

  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!