Skip to main content

Setup

tip

This documentation covers GameAnalytics Unreal SDK version 6.0 and newer. If you are using an older version please check the legacy docs here

In this integration guide we will take you through the most important steps of instrumenting your game with the GameAnalytics Unreal SDK.

Installation

Marketplace Installation

You can download the GameAnalytics plugin directly from the Unreal Marketplace.

After adding GameAnalytics to Unreal verify that the plugin was installed correctly:

  • Make sure the Plugin is enabled by clicking Settings → Plugins.
  • Check Installed → Analytics for the GameAnalytics plugin.
  • Check Built-In → Analytics for enabling the Analytics Blueprint Library

Finally, add the following to your project’s DefaultEngine.ini file located in the Config folder.

[Analytics]
ProviderModuleName=GameAnalytics

And include the GameAnalytics header file to wherever you are using the SDK:

#include "GameAnalytics.h"
#include "GameAnalyticsModule.h"

Activating the plugin

In order to activate the plugin you need to follow the steps below:

  • Restart the Unreal Editor
  • Open the Plugins menu (Window > Plugins)
  • Under Analytics enable the GameAnalytics plugin
  • Enable the Blueprint Analytics Framework (if you are using blueprints)
  • You will be prompted to restart the editor again Finally, add the following to your project’s DefaultEngine.ini file located in the Config folder
[Analytics]
ProviderModuleName=GameAnalytics

Using GameAnalytics from C++

If you are planning to use the GameAnalytics SDK directly from your C++ code you need to add GameAnalytics to PrivateDependencyModuleNames and PrivateIncludePathModuleNames in your project’s *.Build.cs file:

PrivateDependencyModuleNames.AddRange(new string[] { "GameAnalytics" });
PrivateIncludePathModuleNames.AddRange(new string[] { "GameAnalytics" });

Sign Up

Account Creation

If you have not already, you can register for a GameAnalytics accounts via our online form here.

After you have signed up you will be asked to create a studio and a game. If your game is already published and on an app store you can search for it using the provided search field or else you can create it manually.

Login

Inside the Account tab you can login to a GameAnalytics account directly in the editor.

Login through Project Settings allows you to select your studio and game for each platform. When selected the game key and the secret key will be automatically fetched and configured.

tip

You can always locate the keys in our tool via game settings.

To use GameAnalytics you need a game key and a secret key for each platform you are using (i.e: for a mobile game that may be both iOS and Android).

info

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.

tip

Once a game has been created it can take a few minutes before the GameAnalytics servers will accept events for that game

Initializing the SDK

There are two ways of using the GameAnalytics plugin inside your C++ code:

  • directly using an instance of an UGameAnalytics object
  • using the IAnalyticsProvider interface

The former will provide all the plugin features, including remote configurations and performance tracking. The IAnalyticsProvider will provide an easier integration inside Unreal, but will only expose limited features.

Due to the inner workings of the module the IAnalyticsProvider will retrieve its settings from Project Settings -> Plugins -> GameAnalytics. While using UGameAnalytics directly will require you to manually call the setup functions (either from C++ or Blueprints).

If you are using the IAnalyticsInterface, but desire to enable advanced features of the SDK, you can safely mix calls from both IAnalyticsInterface and UGameAnalytics as both are using the same instance inside the module (provided you initialize the SDK only once).

Initialization

The UGameAnalytics class provides all plugin functionality. The GameAnalytics module will hold an instance of UGameAnalytics*.

Add the headers to your project:

#include "GameAnalytics.h"
#include "GameAnalyticsModule.h"

Initialize the SDK:

UGameAnalytics* GameAnalytics = FGameAnalyticsModule::Get().GetInstance();

// initialize the SDK with your keys
GameAnalytics->Initialize(GAME_KEY, SECRET_KEY);