All Collections
Advertising and SDKs
AppsFlyer Analytics - iOS
AppsFlyer Analytics - iOS

This is a guide to show you how to add AppsFlyer Analytics to your game.

Hue Jacobs avatar
Written by Hue Jacobs
Updated over a week ago

1. Make sure you are using Buildbox 2.3.3 or higher.

2. Go to appsflyer.com and click "Get Started"

3. Enter your account information and click "Continue"

4. They will send you an email so you can verify your account.

5. Go into your email inbox, open up the email from AppsFlyer, and then click "Confirm My Email" 

6. This will take you back to the AppsFlyer website. Click "Add App"

7. You'll get a pop up to Add Your App. Enter in the correct information under "Select the app status", "Add your relevant store details", and "Set the Time Zone and Currency". Then click "Save". 

8. Click the little blue arrow to reveal a dropdown menu. Then select Integrated Partners.

9. Type "Game Analytics" into the search bar and then click GameAnalytics highlighted in blue or click the blue Edit button. They do the same thing. 

10. The GameAnalytics Configuration window will pop up. Don't worry about putting a campaign name and you can set the Click Attribution Lookback Window to however long you want (7 days is recommended) and enable it if you want by checking the Enable box. Next, you need to copy your game key from gameanalytics.com and paste it into the game_key text box. Look at the photos below to see where you can find your game key. If you have not set up a Game Analytics account then you can find information on setting that up in this document

Once logged into your account, this is your Game Analytics Home screen. After adding your game, you can select the little gray gear  to access the Game Settings.

Now you can copy your game key and paste it into the game_key text box on AppsFlyer.

After pasting in the game key, click on the next tab at the top labeled In App Events.

11. Click on Off to open up a drop down menu. Select "All in-app events (To enable: Re-targeting, optimization, PPE). Then paste in your game key into the gamekey text box.

This will allow you to add an SDK Event. Select "+ Click to add in app event mapping". Then choose to "Map all SDK events" and then check the box to "Send Value". Then click Save & Close.

12. Next we need to go to the AppsFlyer SDK Integration page. 

Scroll down to 2. Quick Start. Select the "Static Framework" tab and click Download highlighted in blue. Or, you can download it here. Save this web page. You'll need it later.

13. Now it's time to export your game from Buildbox. Select iOS when exporting. 

14. Open up your exported game folder and click BBPlayer.xcodeproj to open up your Xcode project. 

15. Open the AppsFlyerLib.framework.zip file and drop it into your Xcode project above the BBPlayer folder.

16. Click on the AppDelegate.mm file. This should open up the file in the window on the right. Add this line of code near the top: 

#import <AppsFlyerLib/AppsFlyerTracker.h>

17. Next add in these lines of code inside the function "didFinishLaunchingWithOptions: (NSDictionary *)launchOptions"

[AppsFlyerTracker sharedTracker].appsFlyerDevKey = @"YOUR DEV KEY";
[AppsFlyerTracker sharedTracker].appleAppID = @"YOUR APP ID";
[AppsFlyerTracker sharedTracker].delegate = self;
#ifdef DEBUG
 [AppsFlyerTracker sharedTracker].isDebug = true;
#endif

This should give you an error. I will help you fix that error in the next step. Let's fix the error first and then I will tell you where you can find your Dev Key and your App ID in step 19.

18. Click on your AppDelegate.h file and add this line of code near the top:

#import <AppsFlyerLib/AppsFlyerTracker.h>

Then add a comma after UIApplicationDelegate and type in AppsFlyerTrackerDelegate as shown below. 

19. Now go back to your AppDelegate.mm and we will put in your Dev Key and your App ID. You can find your Dev Key and App ID by going back to your AppsFlyer My Apps Page, opening up the drop down menu again, and selecting App Settings. 

20. Copy your Dev Key from the top of the page and paste it into your AppDelegate.mm file where it says "YOUR DEV KEY". 

Then scroll down to the bottom of the App Settings page and copy your App ID and paste it into your AppDelegate.mm file where it says "YOUR APP ID".

21. Now add this line of code inside the "applicationDidBecomeActive" function:

// Track Installs, updates & sessions(app opens) (You must include this API to enable tracking)          
[[AppsFlyerTracker sharedTracker] trackAppLaunch];        
// your other code here.... }

22. Next, you need to whitelist your phone through AppsFlyer. Follow along with these instructions here to whitelist your phone. 

23. After whitelisting your phone, go to your My Apps page on AppsFlyer and click on your app. Then scroll down until you see the integration section on the left. Click "SDK Integration Tests". 

24. Now select In-app Events and we will run a test. 

25. Choose your whitelisted device and click "Next".

26. This is will start the test so go back to Xcode and press the run button (looks like a play button) and run the app on your white listed device. 

27. There ya go! Start playing your game and you should start seeing data pour in on AppsFlyer like this: 

That should do it! You have now successfully added AppsFlyer Analytics to your Buildbox game and it's just a matter of implementing the specific events your prospective publisher is asking you to track. Hope this guide helped! 

Did this answer your question?