SDK Migration - Unreal SDK (v4)

You can find out what's required to update the Airbridge Unreal SDK. We recommend that you check everything from your current version onwards to the version after the update.

Update from v1.x.x to v4.0.0

Check it out when you update the Airbridge Unreal SDK to v4.0.0.

You can find out what's required to update the Airbridge Unreal SDK. We recommend that you check everything from your current version onwards to the version after the update.

Installing and initialising the SDK

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();

Replaced FAirbridgeUnreal::SetDeeplinkCallback function with 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 information

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");

Make 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
+    }
+);

Replaced FAirbridgeUnreal::SetAttributionCallback function with 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
- }

Setting device identifiers

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();

Setting up hybrid apps

Replaced FAirbridgeUnreal::CreateWebInterface function with FAirbridge::CreateWebInterfaceScript , 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?