Setup
In this integration guide we will take you through the most important steps of instrumenting your game with the GameAnalytics Unreal SDK.
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"
Manual Installation
Alternatively you can download the plugin from our github page.
There are 2 ways of installing the plugin manually:
- Integrating into the engine full source version (editor compiling)
- Installing into a specific project (using pre-compiled editor)
Full Source Version
When using the full source version you compile the Unreal Editor yourself. It is possible to add the plugin at this stage to be part of the engine and available for all projects created using that compiled version.
Navigate to your Unreal Engine directory and place the GameAnalytics
folder inside the folder EnginePluginsRuntimeAnalytics
Specific Project (using pre-compiled editor)
A pre-compiled editor can be downloaded through the Epic Games Launcher or built from source. When GameAnalytics is not part of the editor it needs to be added to the specific project.
Add the GameAnalytics
folder to a Plugins subfolder in your specific project folder. If this Plugins subfolder doesn’t exist then create one.
Finally you can compile the project.
The project has to be a C++ project for the plugin to work! A pure blueprint project won't work.
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 theConfig
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" });
Common Issues
Sqlite conflict
If you experience a Sqlite conflict with another SDK you can manually remove the sqlite
library from the plugin.
The plugin is located under GameAnalytics/Source/Thirdparty/lib
folder and the respective platform folder (only necessary for osx, windows and linux).
You will also need to edit the GameAnalytics/Source/GameAnalytics/GameAnalytics.Build.cs
and comment out the next line for the needed platforms:
PublicAdditionalLibraries.Add(Path.Combine(libPath, "[platform]", "Sqlite.lib"));
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.
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).
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.
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
From Blueprints
To initialize the GameAnalytics SDK in Blueprint you must first call The Analytics Blueprint Library action called Start Session
.
You should call Start Session
before sending any events.
The Start Session
action alone is enough to track general user metrics such as DAU (Daily Active Users), MAU (Monthly Active Users), Retention, etc.
From C++ code
To initialize the plugin you will have to call the following function:
UGameAnalytics::initialize("GAME_KEY", "SECRET_KEY");