1. Make sure that you're using Buildbox 2.3.3 or higher

2. Go to gameanalytics.com and click “Sign up for free”

3. This will take you to the signup page. Enter your email and click the “Sign up” button.

4. They will take you to this page where they tell you that they have sent you a verification email.

5. Go to your email inbox, open up the verification email and click the “Activate account” button.

6. This will take you to your home dashboard page. Click one of the “Add game” buttons.

7. Now enter the title of your game into the search bar and click the “Search” button. If your game is not in the app store, then click the orange “My game is not available in an app store” button.

8. Enter the game title and click the iOS button.

9. Next, enter in your game’s Bundle Identifier and click “Next”.

10. Then select your game’s genre and click the “Add game” button.

11. Now click iOS from the Quick Guides.

12. Then click the “Download the iOS SDK” button and then click the “Next step” button.

13. Hold onto the web page for now. We will come back to it. Next, open up Buildbox and export your game to iOS.

14. Then go into your iOS export folder and open up your Xcode project by double clicking on the file ending in .xcodeproj. Make sure you have Xcode installed and updated beforehand. 

15. Now that you have your Xcode project open, we just need to add a framework and a few lines of code and we are good! So first, open up the zip file that you downloaded earlier from the game analytics website. It should be titled “GA-SDK-IOS-master.zip”. Then open up the folder that comes out of the zip file and you should see the GameAnalytics.framework.

16. Next, drag that framework into your BBPlayer Xcode project. You can drag it into your Frameworks folder. 

17. Now open up your BBPlayer folder and select the AppDelegate.mm file.

18. The code in this file should open up on the right and start by adding this line of code near the top: 

#import <GameAnalytics/GameAnalytics.h>

#include "screens/PTPScoreController.h"

19. Inside the function titled “didFinishLaunchingWithOptions:(NSDictionary *)launchOptions”, put in these lines of code between the curly brackets { }:

//For Debugging Purposes Only
[GameAnalytics setEnabledInfoLog:YES];   **Note** This line of code is OPTIONAL. It is used for debugging and checking the log to make sure the data you're sending is accurate. You can remove this code once you're done checking and before sending to a publisher. 

//GameAnalytics Set Build Version
[GameAnalytics configureBuild:@"1.0.0"]; **Note** This line of code tells GA what version your game is running on. It should be the same number as your version number from the project. Whenever you do an update, you should change this number accordingly. This enables you to filter the analytics by version number. This can be important when making big changes to your game and wanting to see how certain things are affected when running a new build.

//GameAnalytics Initialize
[GameAnalytics initializeWithGameKey:@"game key" gameSecret:@"secret key"];

You can find your game key and secret key on the game analytics website on the right side.

20. There’s a couple options on this next step, depending on how you determine the score in your game. Go down to the function titled “screenOnEnter:(const char*) name” and enter these lines of code in between the brackets { }:

 //Make sure you include this line below
NSString* n = [NSString stringWithUTF8String:name];

 //Only add this to track the CURRENT score if your score is measured in DISTANCE

 float score = PTPScoreController::scores().distance.current();

//Only add this to track the CURRENT score if your score is measured in POINTS

float score = PTPScoreController::scores().points.current();

//Only add this to track the BEST score if your score is measured in DISTANCE

float score = PTPScoreController::scores().distance.best();

//Only add this to track the BEST score if your score is measured in POINTS

float score = PTPScoreController::scores().points.best();

//Only add this to track the TOTAL amount of COINS the player has in the game

float coins = PTPScoreController::scores().coins.total();

// Tracks when a game STARTS

if([n isEqualToString: @"The name of your WORLD UI in Buildbox"])

// send Game Analytics event that the game World appeared and game has started
[GameAnalytics addProgressionEventWithProgressionStatus:GAProgressionStatusComplete progression01:@"game" progression02:@"nil" progression03:nil score:score];


// Tracks when a game ENDS 

 if([n isEqualToString: @"The name of your GAME OVER UI in Buildbox"])

 // send Game Analytics event that Game Over was triggered

[GameAnalytics addProgressionEventWithProgressionStatus:GAProgressionStatusComplete progression01:@"game" progression02:@"nil" progression03:nil];



21. Finally, go back to the game analytics website and click the orange “Next step” button through all of the remaining steps until you get to the last orange button that says “Go to standby page”. Then click that button.

22. The page should look like this, but with all zeros instead of the data I’m showing. You’ll want to run and test your app on a simulator or device next through Xcode and the data will start pouring in on the website. It takes a little while so don’t get impatient. I thought it wasn’t working, but it just takes a little bit of time even on the live feed. Also, make sure your bundle identifier is correct on gameanalytics.com and Xcode too because that could mess you up. Hope this helps! :)

 **Note** Don't forget to remove the line of code that is used for debugging (Step 19). You can also just leave it in there if you want, but it's unnecessary.  

Did this answer your question?