Game Analytics Setup

NOTE: The example names you’ll find in the AppDelegate.mm come from a simple game with a mind-map that looks like the image below:

1. Setup GameAnalytics keys

  • Find your GameAnalytics Game-Key and Secret-Key (home->YOUR_GAME->Settings)
  • In AppDelegate.mm, find the lines that looks like:#define GA_GAME_KEY @"REPLACE_ME"#define GA_SECRET_KEY @"REPLACE_ME"
  • Replace the REPLACE_ME text with your Game-Key and Secret-Key respectively.

2. Set up the UI names for Game Analytics

  • Open AppDelegate.mm
  • Find the line that looks like:#define GA_START_UI_NAME @"Game Started"
  • Replace Game Started with the name of the UI node from your game’s Mind Map that loads when the game starts. Every time this UI is loaded, the code below will tell GameAnalytics that the player has started at the very beginning of your game.
  • Find the line that looks like:#define GA_GAME_OVER_UI_NAME @"Game Over Dude"
  • Replace Game Over Dude with the name of the UI node from your game’s Mind Map that loads when the player has a Game-Over (i.e. runs out of lives, has to start over, etc.). Every time this UI is loaded, the code below will tell GameAnalytics that the player failed to complete the game.
  • Find the line that looks like:#define GA_GAME_COMPLETE_UI_NAME @"End Credits"
  • Replace End Credits with the name of the UI node from your game’s Mind Map that loads when the player beats the entire game. Every time this UI is loaded, the code below will tell GameAnalytics that the player completed the game.
  • Find the line that looks like:#define GA_LEVEL_UI_NAMES @[@"Level 1", @"Level 2", @"Level 3"]
  • If your game does not have levels or you do not want to send events to GameAnalytics when the player completes individual levels, delete this line and skip to the Tenjin Setup section of this document.
  • Replace Level 1, Level 2, and Level 3 with the names of the UI nodes from your game’s Mind Map that load when the player completes a specific level (i.e. Level 2). If your game has more than three levels, add a comma after the double-quote at the end of the current last level, and add your new UI name surrounded by double quotes, and preceded by an @ symbol.Example: If your GA_LEVEL_UI_NAMES currently looks like#define GA_LEVEL_UI_NAMES @[@"cool 1", @"rad 2", @"sweet 3"]but you have a fourth level named lit 4. You would change the line to look like this:#define GA_LEVEL_UI_NAMES @[@"cool 1", @"rad 2", @"sweet 3", @"lit 4"]

3. For more information on the GameAnalytics code you’ll find in AppDelegate.mm, check out this buildbox article:http://help.buildbox.com/en/articles/1638320-game-analytics-ios

Tenjin Setup

1. Create a Tenjin account and follow all of their recommended instructions. Make sure to set up IronSource as a marketing channel using your IronSource API key.

2. Replace TJ_API_KEY with your Tenjin API key (NOT your IronSource API key mentioned in step 1)

  • Log into the Tenjin dashboard and find your app’s API keyhttps://www.tenjin.io/dashboard/docs
  • Open AppDelegate.mm
  • Find the line that looks like:#define TJ_API_KEY @"REPLACE_ME" 
  • Replace REPLACE_ME with your Tenjin API key

Build the project

  1. Make sure your code signing settings are set up correctly https://help.apple.com/xcode/mac/current/#/dev60b6fbbc7
  2. Make sure you have a REAL-PHYSICAL iOS device plugged in and selected in the dropdown near the Play and Stop buttons in the top left (the XCode project won’t build correctly if you have a device simulator selected)

3. Press the play button (or cmd-r) to build the project and run it on your phone. NOTE: XCode will issue warnings (yellow triangle) even if everything is configured properly. If you see errors (red circle) something went wrong and you might need to contact us for more support. 

Did this answer your question?