Unreal Engine

🛠️ IN BETA 🛠️

At the moment, Amplitude's Unreal Engine SDK only supports projects targeting iOS, MacOS, or tvOS.

We're working on adding the following throughout the beta

In the future, we may also

  • Support non-Unreal Engine APIs with features found in other SDKs (e.g. user properties)
  • Support more platforms (e.g. PC, consoles)

SDK Installation

1. Install the SDK Plugin

You can install the Unreal Engine SDK by downloading the latest version of AmplitudUnreal.zip found in our GitHub releases. Unzip it into a folder inside your Unreal project's Plugins directory.

mkdir -p Plugins/AmplitudeUnreal
unzip AmplitudeUnreal.zip -d Plugins/AmplitudeUnreal

2. Enable the SDK Plugin in the editor

Open your project in the UE4 editor. Navigate to Settings -> Plugins -> Project -> Analytics and make sure AmplitudeUnreal is enabled

3. Set Amplitude as your Analytics Provider

Navigate to Settings -> Project Settings -> Analytics -> Providers and set the fields to Amplitude

4. Add your API keys

Navigate to Settings -> Project Settings -> Analytics -> Amplitude and fill in the fields with your API key

5. Include Analytics Modules

In any file that involves instrumentation, you should include the necessary Unreal Engine analytics headers.

#include "Runtime/Analytics/Analytics/Public/Analytics.h"
#include "Runtime/Analytics/Analytics/Public/Interfaces/IAnalyticsProvider.h"

Usage and Examples

The API of Amplitude Unreal follows the analytics provider interface defined by the Unreal Engine.

Logging Basic Events

FAnalytics::Get().GetDefaultConfiguredProvider()->StartSession();
FAnalytics::Get().GetDefaultConfiguredProvider()->RecordEvent(TEXT("Game started"));
FAnalytics::Get().GetDefaultConfiguredProvider()->EndSession();

Logging Events with Properties

TArray<FAnalyticsEventAttribute> AppendedAttributes;
AppendedAttributes.Emplace(TEXT("Test Event Prop key1"), TEXT("Test Event value1"));
AppendedAttributes.Emplace(TEXT("Test Event Prop key2"), TEXT("Test Event value2"));
FAnalytics::Get().GetDefaultConfiguredProvider()->RecordEvent(TEXT("Test Event with Property"), AppendedAttributes);

Setting User Properties

The generic Unreal Engine IAnalyticsProvider only allows access to a limited amount of user properties.

FAnalytics::Get().GetDefaultConfiguredProvider()->SetLocation(TEXT("Test location"));
FAnalytics::Get().GetDefaultConfiguredProvider()->SetGender(TEXT("Test gender"));
FAnalytics::Get().GetDefaultConfiguredProvider()->SetAge(TEXT(27));

Setting Custom User IDs

FAnalytics::Get().GetDefaultConfiguredProvider()->SetUserID(TEXT("[email protected]"));


Did this page help you?