Experiments
This API is used to read the experiments the local player is currently enrolled in.
For more information about Experiments, visit the Experiments Guide.
Enrollment happens automatically: loading a configuration evaluates active experiments for the local player, and the values from the Configs service already include the assigned group's changes. This service is read-only, for display, analytics segmentation, and debugging.
#include "GamebeastExperiments.h"
UGamebeastExperiments* GamebeastExperiments = UGamebeastSubsystem::Get(this)->GetExperiments();Types
FGamebeastExperimentAssignment
USTRUCT(BlueprintType)
struct FGamebeastExperimentAssignment
{
int64 ExperimentId;
FString ExperimentName; // Empty until the first check for changes.
int64 GroupId;
FString GroupLabel; // Empty until the first check for changes.
FString ConfigurationAlias; // The configuration whose evaluation reported it.
FString Source; // "weightedHash", "roundRobin" or "manual".
};GetAssignments()
TArray<FGamebeastExperimentAssignment>return type
The player's assignments across every configuration loaded so far, sorted by experiment id.
Usage
for (const FGamebeastExperimentAssignment& Assignment : GamebeastExperiments->GetAssignments())
{
UE_LOG(LogTemp, Log, TEXT("%s: %s"), *Assignment.ExperimentName, *Assignment.GroupLabel);
}OnAssignmentsChanged
Fires with the full list whenever it changes: when a configuration reports new assignments, when names arrive, and after Identify. Bind the Blueprint event, or OnAssignmentsChangedNative in C++:
GamebeastExperiments->OnAssignmentsChangedNative.AddUObject(this, &UMyHud::HandleAssignments);Targeting
Experiments can target players by these fields, which the SDK sends with every evaluation. They're offered on the dashboard as Unreal fields:
| Field | Values |
|---|---|
| Platform | windows, mac, linux, ios, android, playstation, xbox, switch |
| Device | pc, mobile or console, derived from the platform |
| Country | ISO country code from the device's region setting, like US. Not the player's location. |
| Language | ISO language code from the device's language setting, like en |
| Game version | Your Project Version (Project Settings > Description) |
| Engine version | Like 5.4.2 |
Each is unknown when the device can't say. To target anything else, add it to FGamebeastSetupOptions::UserProperties: strings, numbers, booleans, or arrays of one of those. They're targeted as custom properties.