SDK Migration - Unreal SDK (v4)

This article contains the information required to update the Airbridge Unreal SDK. We recommend checking the information regarding all versions.

Update from v1.x.x to v4.0.0

Check the information below when updating the Airbridge Unreal SDK to v4.0.

SDK installation and initialization

The location of the Airbridge configuration values recorded in the Project > Config > DefaultAirbridge.ini file has been moved to the [/Script/AirbridgeEditor.AirbridgeSettings] section of the Project > Config > DefaultEngine.ini file.

The FAirbridgeUnreal::StartTracking function has been replaced with the FAirbridge::StartTracking function.

12
- FAirbridgeUnreal::StartTracking();
+ FAirbridge::StartTracking();

The FAirbridgeUnreal::StopTracking function has been replaced with the FAirbridge::StopTracking function.

12
- FAirbridgeUnreal::StopTracking();
+ FAirbridge::StopTracking();

Deep Linking

The FAirbridgeUnreal::SetDeeplinkCallback function has been replaced with the FAirbridge::SetOnDeeplinkReceived function.

1234567891011121314151617181920
- AExampleGameModeBase::AExampleGameModeBase()
- {
-   AirbridgeCallbacks = CreateDefaultSubobject<UAirbridgeCallbacks>(TEXT("AIRBRIDGE_CALLBACKS"));
- }

void AExampleGameModeBase::BeginPlay()
{
-    AirbridgeCallbacks->OnDeeplinkReceived.AddDynamic(this, &AExampleGameModeBase::OnDeeplinkReceived);
-    FAirbridgeUnreal::SetDeeplinkCallback();

+    FAirbridge::SetOnDeeplinkReceived([](const FString& Url)
+    {
+        // show proper content
+    });
}

- void AExampleGameModeBase::OnDeeplinkReceived(const FString& Url)
- {
-     // show proper content 
- }

In-app events and user data

The FAirbridgeUnreal::TrackEvent function has been replaced with the FAirbridge::TrackEvent function.

12345678910111213141516171819202122232425262728293031323334353637383940
- FAirbridgeUnreal::TrackEvent(
-    AirbridgeConstants::CATEGORY::ORDER_COMPLETED,
-    UAirbridgeEventOption::CreateObject()
-    ->SetAction("Tool")
-    ->SetLabel("Hammer")
-    ->SetValue(10.0)
-    ->SetSemanticAttributes(
-        UAirbridgeMap::CreateObject()
-        ->Set(AirbridgeConstants::ATTRIBUTES::CURRENCY, "USD")
-        ->Set(AirbridgeConstants::ATTRIBUTES::PRODUCTS, UAirbridgeList::CreateObject()
-            ->Add(UAirbridgeMap::CreateObject()
-                ->Set(AirbridgeConstants::PRODUCT::ID, "12345")
-                ->Set("name", "PlasticHammer")
-            )
-        )
-        ->Set("totalQuantity", 1)
-    )
-    ->SetCustomAttributes(
-        UAirbridgeMap::CreateObject()
-        ->Set("promotion", "FirstPurchasePromotion")
-    )
- );

+ FAirbridge::TrackEvent(
+    AirbridgeCategory::ORDER_COMPLETED,
+    UAirbridgeMap::CreateObject()
+    ->Set(AirbridgeAttribute::ACTION, "Tool")
+    ->Set(AirbridgeAttribute::LABEL, "Hammer")
+    ->Set(AirbridgeAttribute::VALUE, 10)
+    ->Set(AirbridgeAttribute::CURRENCY, "USD")
+    ->Set(AirbridgeAttribute::PRODUCTS, UAirbridgeList::CreateObject()->Add(
+            UAirbridgeMap::CreateObject()
+            ->Set(AirbridgeAttribute::PRODUCT_ID, "12345")
+            ->Set("name", "PlasticHammer")
+        )
+    )
+    ->Set("totalQuantity", 1),
+    UAirbridgeMap::CreateObject()
+    ->Set("promotion", "FirstPurchasePromotion")
+ );

The FAirbridgeUnreal::SetUser function has been replaced with the FAirbridge::SetUser function.

1234567891011
- FAirbridgeUnreal::SetUserID("personID");
- FAirbridgeUnreal::SetUserEmail("persondoe@airbridge.io");
- FAirbridgeUnreal::SetUserPhone("1(123)123-1234");
- FAirbridgeUnreal::SetUserAttribute("key", "value");
- FAirbridgeUnreal::SetUserAlias("key", "value");

+ FAirbridge::SetUserID("personID");
+ FAirbridge::SetUserEmail("persondoe@airbridge.io");
+ FAirbridge::SetUserPhone("1(123)123-1234");
+ FAirbridge::SetUserAttribute("key", "value");
+ FAirbridge::SetUserAlias("key", "value");

Additional settings

The FAirbridgeUnreal::Impression function has been replaced with the FAirbridge::Impression function.

12345678910111213
- FAirbridgeUnreal::Impression(TEXT("https://abr.ge/~~~"));

+ FAirbridge::Impression(
+    TEXT("https://abr.ge/~~~"),
+    []() 
+    {
+        // Handle on success
+    },
+    [](const FString& Error)
+    {
+        // Handle on failure
+    }
+);

The FAirbridgeUnreal::Click function has been replaced with the FAirbridge::Clickfunction.

12345678910111213
- FAirbridgeUnreal::Click(TEXT("https://abr.ge/~~~"));

+ FAirbridge::Click(
+    TEXT("https://abr.ge/~~~"),
+    []() 
+    {
+        // Handle on success
+    },
+    [](const FString& Error)
+    {
+        // Handle on failure
+    }
+);

The FAirbridgeUnreal::SetAttributionCallback function has been replaced with the FAirbridge::SetOnAttributionReceived function.

1234567891011121314151617181920
- AExampleGameModeBase::AExampleGameModeBase()
- {
-   AirbridgeCallbacks = CreateDefaultSubobject<UAirbridgeCallbacks>(TEXT("AIRBRIDGE_CALLBACKS"));
- }

void AExampleGameModeBase::BeginPlay()
{
-    AirbridgeCallbacks->OnAttributionReceived.AddDynamic(this, &AExampleGameModeBase::OnAttributionReceived);
-    FAirbridgeUnreal::SetAttributionCallback();

+    FAirbridge::SetOnAttributionReceived([this](const TMap<FString, FString>& AttributionResult)
+    {
+        // using attribution
+    });
}

- void AExampleGameModeBase::OnAttributionReceived(const FAirbridgeAttribution& Attribution)
- {
-     // using attribution
- }

Device identifier setup

12345678
- FAirbridgeUnreal::SetDeviceAlias("ADD_YOUR_KEY", "AND_YOUR_VALUE");
+ FAirbridge::SetDeviceAlias("ADD_YOUR_KEY", "AND_YOUR_VALUE");

- FAirbridgeUnreal::RemoveDeviceAlias("DELETE_THIS_KEY");
+ FAirbridge::RemoveDeviceAlias("DELETE_THIS_KEY");

- FAirbridgeUnreal::ClearDeviceAlias();
+ FAirbridge::ClearDeviceAlias();

Hybrid app setup

The FAirbridgeUnreal::CreateWebInterface function has been replaced with the FAirbridge::CreateWebInterfaceScript and the FAirbridge::HandleWebInterfaceCommand functions.

123456789101112131415161718
- TUniquePtr<IAirbridgeWebInterface> AirbridgeWebInterface;
+ FString WebInterfaceScript;

- AirbridgeWebInterface = TUniquePtr<IAirbridgeWebInterface>(FAirbridgeUnreal::CreateWebInterface(
-     TEXT("YOUR_WEB_TOKEN"),             
-     [](const FString& Msg) -> FString   
-     {
-         return TEXT("...");
-     }
- ));

+ WebInterfaceScript = FAirbridge::CreateWebInterfaceScript(
+     TEXT("YOUR_WEB_TOKEN"),	
+     [](const FString& Msg) -> FString
+     {
+         return TEXT("...");
+     }("payload")
+ );

Was this page helpful?

Have any questions or suggestions?