Quickly start up your Unreal integration with Leanplum

This article is your first step to activating the Leanplum Unreal SDK. Once completed, you will have access to all the goodness Leanplum provides. Follow the steps below.

The Leanplum Unreal SDK includes wrappers around the native iOS and Android SDKs.

The following matrix shows the features supported by each platform:

Data modeling-
In-app messaging-
Push notifications-
App Inbox---

Install the SDK

STEP 1: Download the Leanplum Unreal Plugin

Download the latest version of Unreal SDK from our Github repository. The repository also contains a host application for testing purposes.

STEP 2: Import the Leanplum Unreal Plugin into your project

Copy the contents of Plugins/LeanplumSDK into your project folder under Plugins directory.

To enable the plugin, either modify project plugins and enable LeanplumSDK, or edit your project .uproject file and enable the SDK

A: Add app keys

Open your GameMode and copy your appId and clientKeys into the newly created variables. You can find these in App Settings and clicking Keys & Settings.

B: Edit the level blueprint & Initialize the SDK

Open your level blueprint that opens first when your game starts to initialize the Leanplum SDK and call start method. You can customize the start call by providing User ID and User Attributes.

STEP 3: Run Your Build

Build and run your app and see data start flowing into Leanplum. With your development key in your app delegate, you will be able to see all data flowing into Leanplum in our debugger. You can access our debugger dashboard at https://leanplum.com/dashboard#/help/debug

STEP 4: Register Your Test Device

Registering your device as a test device will allow you to preview your messages, variable changes, and any other Leanplum projects. Follow the below to register. Visit https://leanplum.com/dashboard#/account/devices and click on "Register" to register your device

STEP 5: Complete Your Integration

Success! You have now successfully installed the Leanplum Unreal SDK and registered a test device for further testing. This is an exciting first step on the journey to full integration with Leanplum.

To complete your integration with Leanplum, check out the below articles to learn more about your user data, tracking with Leanplum, variables, importing data, and setting up messages.

Tracking User Information

User information can be tracked from blueprints or code. You can explore the LeanplumSDK functions and blueprints code.

User IDs

When Leanplum starts for the first time in your app, it creates a new user profile or User ID. Unless you set up your own concept of User IDs, the UserID value will be identical to the DeviceID value, and Leanplum will start tracking sessions for this user. However, you can set your own user id by passing a user id. This way, you can store multiple devices under a singular user id.

On User Login

While you are able to pass in a user id on the Leanplum.start() call, to track user activity early on it is best to set the user ID in Leanplum upon the user logging in.

Once you set the user ID for the first time on a device, the existing profile in Leanplum will updated with that user ID and all previously tracked data remains.

After the initial call, each time you set a different User Id on login, you will end the current User session, and create a new session on the new User. If the new User ID doesn't exist, a new User Profile will be created in Leanplum.

/// <summary>
/// Sets the custom user ID.
/// </summary>
/// <param name="UserID">The custom user ID.</param>
static void SetUserID(const FString& UserID);
static void SetUserID(const FString& UserID, const TMap<FString, FString>& Attributes);

Device IDs

Refer to the information about Device IDs on the Device IDs page.

User Attributes

User Attributes on the Leanplum platform have many uses and are really powerful in creating meaningful engagements with your users. The main uses include: Personalizing content, Segmentation Targeting, Filtering and Grouping reports.

/// <summary>
/// Sets the user attributes.
/// </summary>
/// <param name="Attributes">Attributes to set.</param>
static void SetUserAttributes(const TMap<FString, FString>& Attributes);

Tracking User Behavior

The Leanplum SDK automatically tracks session information and other limited amounts of user data for you. Leanplum is also able to track more detailed data points you collect on a user. Events can be used to target users for certain messages, tests, or other content changes.

Events and states can be tracked from blueprints or code. You can explore the LeanplumSDK functions and blueprints code.

Tracking an Event

An event is anything that can occur in your app. Events include actions like clicking a link, sharing an update, purchasing a subscription or other in-app asset, killing enemies etc. All events are timestamped according to when they occur. Thus, it is not advisable to log too many events, as each one will have to be sent to our server.

Events can have a value and parameters that can be used for triggering, segmentation, and analytics.

/// <summary>
/// Logs a particular event in your application. The string can be
/// any value of your choosing, and will show up in the dashboard.
/// </summary>
/// <param name="Name">Name of the event to track.</param>
static void Track(const FString& Name);
static void Track(const FString& Name, double Value);
static void Track(const FString& Name, double Value, const FString& Info);
static void Track(const FString& Name, double Value, const FString& Info, const TMap<FString, FString>& Parameters);

Advancing to a State

A state is a time-based event in Leanplum. All states have a time and a duration. The duration is set automatically — when one state begins, the previous one ends.

/// <summary>
/// Advances to state.
/// </summary>
/// <param name="State">State to advance to.</param>
static void AdvanceToState(const FString& State);
static void AdvanceToState(const FString& State, const FString& Info);
static void AdvanceToState(const FString& State, const FString& Info, const TMap<FString, FString>& Parameters);

Tracking Monetization Events

In Leanplum, we offer the additional capability to track purchases or other monetization events. You can do this by tracking a Purchase event. Once in Leanplum, you will see the revenue metrics in your Analytics reports.
Leanplum can also do currency conversions.

/// <summary>
/// Manually tracks InApp purchase and can do server side receipt validation.
/// </summary>
/// <param name="Name">IAP name</param>
/// <param name="Value">value of the IAP</param>
/// <param name="CurrencyCode">Currency code.</param>
/// <param name="Parameters">Additional parameters.</param>
static void TrackPurchase(const FString& Name, float Value, const FString& CurrencyCode, const TMap<FString, FString>& Parameters);

Push Notifications

To set up push notification support with your Unreal project, Leanplum provides a couple of built-in methods that will help you depending on the platform your game is played on.

iOS Setup


You need to enable your iOS project for push notifications. To be able to do it you will have to compile the Unreal Engine from source and enable the Remote Notifications in Project Settings.
Refer to official Unreal Engine documentation here.


You can ask the user to allow your app for remote notifications directly from Unreal. This is done by calling the below method from blueprints or C++ after Leanplum starts (Leanplum.start()). This will register the device through the iOS framework to receive alerts, badges, and sounds - it will directly show the native iOS prompt.
Note that you can use Push Pre-Permission instead of directly showing the native prompt.

UFUNCTION(BlueprintCallable, Category = "Leanplum")
static void RegisterForRemoteNotifications();


For iOS push notifications to work with Leanplum, you'll also need to upload your .p12 certificates to Leanplum. Refer to the iOS SDK docs for instructions on how to do that.

If you want to use Rich Push Notifications follow the iOS guide on how to enable them.
To implement push notifications with your Unity Android project, you will need to follow the below steps:

Android Setup


On Android, you can setup Firebase Cloud Messaging through Gradle.


Go to the project folder -> Plugins -> LeanplumSDK -> Source -> LeanplumSDK. Open the LeanplumSDK_Android_UPL.xml file. Uncomment the Firebase dependencies.

implementation platform('com.google.firebase:firebase-bom:26.7.0')
implementation 'com.google.firebase:firebase-messaging'


Set the desired firebase-messaging version.


Add your google-services.json file to your project Config folder.


Add the Google Server API key in the Leanplum App settings on the Dashboard

Test Push Notifications

Once you've set up push notifications, test that it is working properly by sending a push notification to your development devices.