Skip to main content

Advanced Setup

Game Settings

Game Keys

  • To use GameAnalytics you need a game key and a game secret for each platform you are using (iOS / Android).
  • The game key is a unique identifier for your game while the secret key is used to protect event data from being tampered with as it travels to the GameAnalytics servers

Build Version

  • The build is used to specify the current version of your game. Specify it using a string. Recommended using a 3 digit version like [major].[minor].[patch]
  • The build version should be used for changing production builds of the game. We recommend creating a separate game when implementing or testing the SDK.

Custom Dimensions

  • During gameplay, it is possible to set values for 3 different custom dimensions.
    GameAnalytics.SetCustomDimension01("human");
GameAnalytics.SetCustomDimension02("paladin");
GameAnalytics.SetCustomDimension03("undead");
  • For each custom dimension, it is needed specify a whitelist.
  • You cannot set a custom dimension value unless it is specified here first. For more information about custom dimensions click here.

Resource types

  • When submitting resource events you specify a resource currency and resource item type. It is needed to specify a whitelist for each of these.

    GameAnalytics.SetAvailableResourceCurrencies({"gold", "gems"});
  • You cannot submit a resource event using other values than specified here in the settings.

  • Each resource currency string should only contain [A-Za-z] characters.

Player Settings

  • It is imperative to avoid including non-alpha-numerical characters in the company name in PlayerSettings.
  • This name is included when creating temporary local files and as a result a character like ; would break the path to these files.

Advanced Settings

Manual Session Handling

If enabled manual session handling will be enabled automatically just before initialization. To manual enable or disable session handling later on call this:

 GameAnalytics.SetEnabledManualSessionHandling(true);
info

Read more about sessions here.

Send version as build number (only Android, iOS)

If enabled (only works for Android and iOS builds) the app version will automatically be detected and used for the build field.

Submit Errors

  • Enable this to catch error and exception messages within Unity when the game is running and submit them to GameAnalytics.
  • This is useful for discovering unforeseen issues after the game has been launched. It will submit an error event using the type error, warning or critical.
info

After a game has been launched it will only send a maximum of 10 error events automatically. Some games can generate a lot of exceptions and this cap will prevent degraded performance and unintended bandwidth usage.

Native Error Reporting (only Android, iOS)

If enabled (only works for Android and iOS builds) the SDK will automatically send error event for native unhandled exceptions. In most cases the SDK can send the error event straight away when the app/game crashes but else the error event should be sent in next session.

Automatic FPS submission

By default, GameAnalytics will collect and submit the application fps for iOS and android applications as long as you're using version 4.7.0 or later.

Submit Average FPS

  • Enable this to calculate and submit average FPS automatically.
  • The frame rendering will be monitored during an interval of 20 seconds. Then a design event called GA:AverageFPS is submitted with the average FPS as a value

Submit Critical FPS

The average FPS is useful for general performance overview, but it will not detect critical FPS drops. These drops are often more noticeable by players versus a low (but steady) average FPS.

Enable the critical fps detection to submit an event when sudden drops in FPS are detected. This is done by calculating average FPS over the last second. If this should drop below 10 it will register this occurrence internally. After 20 seconds it will select the lowest critical FPS registered (if any) and submit a design event called GA:CriticalFPS with the critical average FPS.

Debug Settings

The SDK is designed to be as silent as possible and use few resources. You will therefore not get much information by default when actions or errors occur.

The SDK consists of Unity code (C# wrapper) that call code inside some native libraries (iOS / Android). When playing in the editor the native code is not compiled/used. To get the detailed console output generated from the native code it is needed to compile/launch the game in native.

1. Info Log Editor

When playing in the editor you will get output whenever an event is added from Unity code. It will not submit (from native code) as this part of the SDK is not compiled when playing in the editor. The events are not validated yet and you will therefore not get any errors related to validation or authentication.

info

Use editor debugging when implementing events into your game to verify events are called at the correct place/time and with the intended data

2. Info Log Build

The info log will output basic information about what is happening when your game is built for native.

3. Verbose Log Build

The verbose log will output the event JSON data that is being sent to the GameAnalytics servers when your game is built for native.

Platform Build

iOS

Using the build script - Unity 5 or higher/ Xcode7

The Unity build-script (GameAnalytics → Editor → GA_PostprocessBuild.cs) will configure the generated Xcode project automatically during the build phase.

caution

This is only supported in Unity 5 or higher (supporting the post-build) and Xcode7+ (using the .tbd libraries).

Manual Configuration

If you are not using Unity 5 or higher (or the process above) then you need to configure build settings manually.

  • In Xcode go to the configuration section called Build Phases and locate the Link Binary With Libraries. Add the following for Xcode7 (using .tbd libraries):
  • AdSupport.framework
  • SystemConfiguration.framework (included by Unity by default)
  • libsqlite3.tbd
  • libz.tbd
  • libGameAnalytics.a
  • AppTrackingTransparency.framework
info

A Unity game will automatically include additional libraries that are not listed above.


caution

If you are deploying testflight builds then please note that user id’s are handled a bit differently. The testflight environment is lacking any useful identifiers (they are random each app launch, at least it used to be like this but in later versions of iOS this behaviour seems to not happen anymore). The SDK will create a random user_id internally and use it for each app launch. If the game is removed and installed again, then a new user_id will be created though and it will register as a new user. Once it is deployed to the app store (or run locally on an actual device) it will track users (returning etc.) correctly.

Android

Merging AndroidManifest
  • If you are using other plugins which have their own AndroidManifest.xml file then you may get build errors.

  • You can delete the AndroidManifest that comes with the GameAnalytics SDK, as long as you include the following in the AndroidManifest you are using:

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Storage Permissions
  • READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions are optional.
  • The SDK will use context.getExternalCacheDir() (if it exists) to store its internal database, as the database can reach up to 10MB if the user keeps being offline for longer periods of time while playing to still be able to send the events when the user is back online.

UWP

Remember to add InternetClient capability under Player Settings in Unity.

Windows Universal Apps

Remember to add the following to your package manifest file:

<Dependencies>
<PackageDependency Name="Microsoft.VCLibs.110.00" MinVersion="11.0.0.0" />
<PackageDependency Name="Microsoft.VCLibs.140.00" MinVersion="14.0.0.0" />
</Dependencies>

Tizien

Add the following capabilities under Tizen settings in Unity (under Publishing settings):

  • NetworkGet
  • Internet