Unity SDK (v4)

    Attention

    This is a guide for the installation and setup of Unity SDK v4. Please check the Unity SDK guide for previous versions.

    You can install the Airbridge Unity SDK and add the settings.

    Install SDK

    The Airbridge Unity SDK can be installed using the method below. After installation, you can confirm whether the SDK has been properly installed through a Unity SDK Test.

    1. Download the latest version of the Airbridge Unity SDK.

    2. Choose Assets > Import Package > Custom Package ... and import the downloaded package file.

    3. The AB180 tab will appear in the menu once the package is installed.

    Install Restricted SDK

    提示

    请根据需求选择 General SDK 或 Restricted SDK, 只能安装其中一个。

    Depending on policies and environments, restrictions on collecting device IDs like GAID and IDFA may be required. When installing the Restricted SDK version, the device IDs are not collected.

    Install the Restricted SDK using the method below.

    1. Download the latest version of the Airbridge Unity SDK.

    2. Choose Assets > Import Package > Custom Package ... and import the downloaded package file.

    3. The AB180 tab will appear in the menu once the package is installed.

    Initialize SDK

    Enter the correct values for the App Name, App Token in the Configure SDK.

    You can find  App Name and App Token in the "Airbridge Dashboard → Settings → Tokens" tab.

    Configure SDK

    Choose AB180 > Airbridge Settings and you will see a screen like the one below. You can omit the key values that don't need to be set.

    Configure ATT Prompt

    提示

    为确保遵守隐私政策所需的功能,应与法律顾问共同审查。

    In the iOS environment, only the IDFA of users who have agreed to information collection in the AppTrackingTransparency (ATT) prompt can be collected as identifiers.

    Event collection should be delayed until the user agrees to tracking. If you collect app installation events before the user agrees to information collection in the ATT prompt, the event will lack an identifier, making performance measurement difficult. We recommend setting a sufficient delay time for event collection in order to collect identifiers.합니다.

    1. Prepare the phrase you will use for the ATT prompt.

    2. Please provide the ATT prompt following the guide provided by Apple.

    3. If the Airbridge Unity SDK doesn't collect installation events, it delays the collection of installation events for 30 seconds until the user agrees to be tracked each time the app is launched. If the user exits the app before deciding whether to allow tracking, it does not collect installation events and will try again on the next app launch.

    The iOS Tracking Authorize Timeout Seconds of Configure SDK can be used to set a longer delay for collecting installation events. The default setting for the iOS Tracking Authorize Timeout Seconds is 300 seconds. It can be set up to a maximum of 3600 seconds (1 hour).

    注意

    请确保为延迟收集安装事件预留足够时间。在用户通过 ATT 弹窗允许追踪之前,如果延迟时间到期,SDK 将会收集不包含 IDFA 的安装事件。

    SDK Opt-In

    提示

    此功能并非必需功能,请在设置前确认需求。

    Opt-In is a policy that does not use user information until the user agrees.

    After setting the Auto Start Tracking Enabled of Configure SDK to false, call the StartTracking function at the point where you can collect events. From the time the StartTracking function is called, events are collected.

    1
    Airbridge.StartTracking();

    SDK Opt-Out

    提示

    此功能并非必需功能,请在设置前确认需求。

    Opt-Out is a policy that does not use user information until the user agrees.

    After setting the Auto Start Tracking Enabled of Configure SDK to true, call the StopTracking function at the point where you can not collect events. From the time the StopTracking function is called, events are not collected.

    1
    Airbridge.StopTracking();

    SDK Signature

    提示

    此功能并非必需功能,请在设置前确认需求。

    With SDK Signature, you can prevent SDK Spoofing and use only events with verified accuracy and safety for advertising performance measurement.

    The SDK Signature setting requires SDK Signature security information. The SDK Signature security information includes Secret ID and Secret. The required SDK Signature security information can be found on the Airbridge dashboard. For more details about SDK Signature security information, please refer to the Airbridge guide.

    1. Enter the SDK Signature Secret ID of Configure SDK

    2. Enter the SDK Signature Secret of Configure SDK

    The information needed for SDK configuration is as follows.

    • sdkSignatureID : Signature ID. This can be found under [Management]>[Fraud Verification Rules]>[SDK Signature] on the Airbridge Dashboard.

    • sdkSignatureSecret : Signature Secret. This can be found under [Management]>[Fraud Verification Rules]>[SDK Signature] on the Airbridge Dashboard.

    By setting up a deeplink, you can direct users who click on ads with tracking links to specific pages of the desired app. Also, based on the information collected through the tracking link, you can check the results that occurred through the deep link in Airbridge.

    When Airbridge generates a tracking link, it automatically selects and utilizes the optimal Airbridge Deeplink depending on the environment, which will be used for user transition, the scheme deeplink (Scheme Deeplink).

    Example)

    • Airbridge Deeplink: https://YOUR_APP_NAME.airbridge.io/~~~

    • Scheme Deeplink: YOUR_SCHEME://product/12345

    When the app is installed, if a user opens the tracking link, the app opens with the Airbridge Deeplink. The Airbridge SDK converts the Airbridge Deeplink into a scheme deeplink that is set on the tracking link. The converted scheme deeplink is delivered to the app.

    If the app is not installed, when a user opens the tracking link, it saves the Airbridge Deeplink. After moving to the app store or website, once the app is installed and run, the Airbridge SDK converts the saved Airbridge Deeplink into a scheme deeplink. The converted scheme deeplink is delivered to the app.

    We are setting up deep links. You will need the information set on the Airbridge dashboard and the app page address used as the user's destination.

    First, register the deep link information in Airbridge.

    After registering the deep link information with Airbridge, you need to set up the deep link in the app. The necessary developments for deep linking in an app include the following:

    • Launch apps with Airbridge deep links.

    • Collect deep link events in the app.

    • Redirect users with Airbridge deep links.

    Please refer to the content below.

    When you click a tracking link set up with a deferred deeplink in a state where the app is not installed, Airbridge saves the deeplink. When a deferred deeplink is set up, the Airbridge SDK acquires the deeplink in the following way.

    Deferred deep links are automatically passed to onDeeplinkReceived callback, so no additional settings are required.

    In-app events

    The Airbridge SDK collects specific user actions that occur in the service, according to the settings, and then sends them as in-app events.

    Send In-App Events

    Setting up a Hybrid App

    You can set up the Unity SDK to handle Airbridge-related work occurring on in-app websites in hybrid apps without changing the website code.

    To send an event, you must call the Airbridge.TrackEvent function. The necessity and type of the components of the Airbridge.TrackEvent function are as follows.

    12345
    public static void TrackEvent(
        string category,
        Dictionary<string, object> semanticAttributes = null,
        Dictionary<string, object> customAttributes = null
    )

    Component

    Required

    Type

    Description

    category

    Required

    String

    Categories in Events

    semanticAttributes

    Optional

    Dictionary<string, object>

    Semantic attributes for events

    customAttributes

    Optional

    Dictionary<string, object>

    Custom attributes for events

    Check the definition and available characters of each component below.

    The standard event categories and semantic attributes provided by the SDK are as follows.

    Refer to the example codes for each type of data below.

    1234567891011121314151617181920
    Airbridge.TrackEvent(
        category: "event",
        semanticAttributes: new Dictionary<string, object>()
        {
            { AirbridgeAttribute.VALUE, 10 },
        },
        customAttributes: new Dictionary<string, object>()
        {
            { "string", "string" },
            { "number", 1000 },
            { "boolean", true },
            {
                "object", new Dictionary<string, object>()
                {
                    { "key", "value" }
                }
            },
            { "array", new List<object>() { "value" } },
        }
    );

    Set Additional In-App Event settings

    提示

    如果未配置其他设置,则将应用默认设置。请查看是否需要其他设置后再继续。

    You can add the necessary settings for the in-app events that you send.

    Example Code

    The main in-app events collected by Airbridge are standard events and custom events. Standard events are those defined by Airbridge. Refer to the example code below.

    Custom events are events that redefine user behavior that does not correspond to standard events to track advertising performance tailored to the app service. Please refer to the example code below.

    1234567891011121314151617181920
    Airbridge.TrackEvent(
        category: "event",
        semanticAttributes: new Dictionary<string, object>()
        {
            { AirbridgeAttribute.VALUE, 10 },
        },
        customAttributes: new Dictionary<string, object>()
        {
            { "string", "string" },
            { "number", 1000 },
            { "boolean", true },
            {
                "object", new Dictionary<string, object>()
                {
                    { "key", "value" }
                }
            },
            { "array", new List<object>() { "value" } },
        }
    );

    User Information

    Sends user information, including events. Based on this user information, we can more accurately analyze advertising performance that occurs on the web and app.

    Set User ID

    The User ID is a user identifier used in the service. The User ID should be a unique ID that can identify a user as one user across the web and app.

    #{"width":"140px"}

    Function

    #{"width":"240px"}

    Description

    Airbridge.SetUserID

    Enter a user ID.

    Airbridge.ClearUserID

    Delete the user ID.

    Airbridge.SetUserAlias

    Enter additional user identifiers. You can enter up to 10.

    - key: Up to 128 characters. It must satisfy the regular expression: ^[a-zA-Z_][a-zA-Z0-9_]*$.

    - value: Up to 1024 characters.

    Airbridge.RemoveUserAlias

    Deletes the specified identifier from the additional user identifiers entered.

    Airbridge.ClearUserAlias

    Delete all additional user identifiers entered..

    Refer to the example below.

    1234567
    // ID
    Airbridge.SetUserID("testID");
    
    // Alias
    Airbridge.SetUserAlias("ADD_YOUR_KEY", "ADD_YOUR_VALUE");
    Airbridge.RemoveUserAlias("DELETE_THIS_KEY");
    Airbridge.ClearUserAlias();

    Set Additional User Information

    注意

    可能包含敏感的用户信息。发送前请咨询法律顾问。

    You can send additional user information by setting user attributes.

    #{"width":"140px"}

    Function

    #{"width":"240px"}

    Description

    Airbridge.SetUserEmail

    Enter the user email. It is hashed with SHA256.

    Airbridge.ClearUserEmail

    Delete the user email.

    Airbridge.SetUserPhone

    Enter the user phone number. It is hashed with SHA256.

    Airbridge.ClearUserPhone

    Delete the user phone number.

    Airbridge.SetUserAttribute

    Enter additional user attributes. You can enter up to 100.

    - key: Up to 128 characters. It must satisfy the regular expression: ^[a-zA-Z_][a-zA-Z0-9_]*$.

    - value: Only supports String, Number, and Boolean types. Up to 1024 characters.

    Airbridge.RemoveUserAttribute

    Delete the specified attribute from the additional user attributes entered.

    Airbridge.ClearUserAttributes

    Delete all additional user attributes.

    Refer to the example below.

    1234567891011121314
    // Automatically hashed on client side using SHA256
    // Can turn off hashing feature with special flag
    Airbridge.SetUserEmail("testID@ab180.co");
    Airbridge.SetUserPhone("821012341234");
    
    // Attributes
    Airbridge.SetUserAttribute("ADD_YOUR_KEY", 1);
    Airbridge.SetUserAttribute("ADD_YOUR_KEY", 1L);
    Airbridge.SetUserAttribute("ADD_YOUR_KEY", 1f);
    Airbridge.SetUserAttribute("ADD_YOUR_KEY", 1.0);
    Airbridge.SetUserAttribute("ADD_YOUR_KEY", "1");
    Airbridge.SetUserAttribute("ADD_YOUR_KEY", true);
    Airbridge.RemoveUserAttribute("DELETE_THIS_KEY");
    Airbridge.ClearUserAttributes();

    Hash user information

    When the User Info Hash Enabled of Configure SDK is set to false, it sends the user's email and phone number without hashing. The default setting is true.

    Reset User Information

    You can initialize user information with the Airbridge.ClearUser function.

    1
    Airbridge.ClearUser();

    Additional SDK settings

    You can additionally set up the Unity SDK.

    提示

    此功能并非必需功能,请在设置前确认需求。

    The deep links received through the Airbridge.SetOnDeeplinkReceived method of the Airbridge Unity SDK include not only Airbridge deep links but also deep links from other solutions.

    1234
    Airbridge.SetOnDeeplinkReceived((string deeplink) =>
    {
        // show proper content using url
    });

    If you set Is Handle Airbridge Deeplink Only to true, only Airbridge deep links will be delivered through the onDeeplinkReceived callback. If you are using deep links from different solutions, you can handle the deep links separately.

    Depending on how the link is opened, it may be difficult to properly use the tracking link of the app in-app.

    By using the Airbridge.Click function or the Airbridge.Impression function, you can properly use the tracking link without going through an external browser.

    Attention

    如果在 Airbridge iOS SDK 1.24.0 及以上版本的 App 中使用追踪链接,将记录 “深度链接页面浏览(Deeplink Pageview)” 目标事件(Target Event)。如果深度链接页面浏览频繁随后深度链接打开(Deeplink Open)发生,可能会影响深度链接打开的绩效。

    深度链接页面浏览的的默认归因窗口为 3 天。如果希望更改此归因窗口,请联系您的 CSM。

    Utilize Attribution Results

    注意

    Airbridge SDK 收集归因结果需要时间,因此不建议将归因结果用于需要实时处理的功能。

    You can receive attribution results for installation events through the Airbridge.SetOnAttributionReceived function.

    1234
    Airbridge.SetOnAttributionReceived((Dictionary<string, object> result) =>
    {
        // Process attribution data
    });

    The value is delivered as follows, depending on the existence of attribution results.

    Attention

    Apply the code below using a custom iOS AppDelegate.

    After the push notification is clicked, you need to pass the deep link information in the payload to the Airbridge SDK to collect the deep link event. Set up the Airbridge.trackDeeplink function.

    iOS

    Add the code below to your custom AppDelegate.

    12345678910111213141516171819202122232425262728293031
    #import "UnityAppController.h"
    
    #import <Airbridge/Airbridge.h>
    #import <UserNotifications/UserNotifications.h>
    
    @interface SomeAppController : UnityAppController<UNUserNotificationCenterDelegate>
    
    @end
    
    @implementation SomeAppController
    
    - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
        UIApplicationState state = UIApplication.sharedApplication.applicationState;
        if (state == UIApplicationStateInactive) {
            NSURL *url = // Deep links in push notification payloads
            
            Airbridge.trackDeeplink(url)
        }
    }
    
    - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
        UIApplicationState state = UIApplication.sharedApplication.applicationState;
        if ((state == UIApplicationStateInactive || state == UIApplicationStateBackground)
            && [response.actionIdentifier isEqualToString:UNNotificationDefaultActionIdentifier]) {
            NSURL *url = // Deep links in push notification payloads
            
            Airbridge.trackDeeplink(url)
        }
    }
    
    IMPL_APP_CONTROLLER_SUBCLASS(SomeAppController)

    Android

    On Android, this is collected automatically, so no setup is required.

    The Airbridge SDK collects deeplink events regardless of the service that created the deeplink, as long as the app is launched by the deeplink. If deeplink events are excessively collected, you can set the Track Airbridge Link Only of Configure SDK to true so that only Airbridge deep links are collected.

    Collect In-Session Lifecycle Events

    SDK collects Open, Foreground events when a new session is started. It does not collect these events while the session is continued.

    By setting the Track In Session Life Cycle Event Enabled of Configure SDK to true, SDK collects Open, Foreground events while the session is continued.

    All collected foreground events are recorded as open events.

    Compliance with Google DMA

    To comply with the Digital Markets Act (DMA), you must pass User Response Information (User Consent) to Airbridge. For more information about the DMA and who it applies to, see the Airbridge guide.

    If you are in the European Economic Area (EEA), you must always pass User Consent information to Airbridge.

    1. Determine the user's region from which they launched your app. If the user launched the app from the EEA(eea=1), check to see if you already have user response information. If you have collected user response information, proceed to step 3.

    If the user launched the app from outside the EEA, you do not need to collect user response information.

    提示

    Airbridge 无法提供有关存储用户同意信息或实现同意弹窗的指导。请咨询法律顾问。

    2. If you don't have any user response information collected, collect user response information from prompts, etc. The information you need to collect in this step is adPersonalization, adUserData.

    3. Set the Auto Start Tracking Enabled of Configure SDK to false.

    4. Initialise the Airbridge SDK and pass user response information to the Airbridge before collecting user information.

    注意

    • 必须为 eeaadPersonalizationadUserData 使用相同的名称。

    • 请根据收集的信息正确输入 01

    1234567891011
    // Set device alias into Airbridge SDK
    
    // Based on actual region
    Airbridge.SetDeviceAlias("eea", "0" /* or "1" */);
    
    // Based on actual user consent
    Airbridge.SetDeviceAlias("adPersonalization", "0" /* or "1" */);
    Airbridge.SetDeviceAlias("adUserData", "0" /* or "1" */);
    
    // Explicitly start tracking
    Airbridge.StartTracking();

    You can provide deferred deeplink in Meta Ads in the following way. The Airbridge SDK collects meta-deferred app links first. If there are no meta-deferred app links, it collects Airbridge deferred deep links.

    SKAdNetwork campaigns in Meta Ads do not support meta deferred app links.

    1. Install the Facebook SDK. See the Meta Ads guide (Unity).

    2. Set the Facebook Deferred App Link Enabled of Configure SDK to true.

    Initialize the Airbridge SDK in Deactivation Mode

    注意

    如果 Airbridge SDK 在初始化后未立即启用,则可能无法收集安装(Install)、打开(Open)、深度链接(Deeplink)事件。

    Initializing the Airbridge SDK enables all features. You can initialize the Airbridge SDK with all features disabled by setting the SDK Enabled of Configure SDK to false.

    Or you can check the activation status of the Airbridge SDK in the following way, and you can activate or deactivate all functions.

    123
    Airbridge.IsSDKEnabled();
    Airbridge.EnableSDK();
    Airbridge.DisableSDK();

    Meta Install Referrer collection settings

    This is a setting needed for collecting Meta Install Referrer. You send the Facebook App ID to the Meta Install Referrer (Facebook App ID) of Configure SDK in the SDK initialization stage.

    After setting, you need to enter the decryption key on the Airbridge dashboard to view the decrypted Meta Install Referrer. Please refer to the Airbridge guide for how to enter the decryption key.

    Set Up Uninstall Event Tracking

    Airbridge sends a silent push every day between 0:00 and 1:00 KST (Korea Standard Time) to users who have tracked an app event at least once in the last 6 months to check if the app has been deleted. You can check the app deletion event through Airbridge reports and raw data extraction.

    Refer to the Airbridge guide for detailed setup methods and explanations.

    Integrate with Third-party Solutions

    SDK setup is required to integrate with some third-party solutions. It is recommended to complete the necessary settings for the third-party solution before collecting data with the Airbridge SDK.

    Refer to the guide below for the settings required for each third-party solution integration.

    SDK Log Setting

    The logs provided by the Airbridge SDK are composed of Debug, Info, Warning, Error, and Fault levels. Debug level is the least critical log, and Fault level is the most critical log.

    By default, the Airbridge SDK provides logs at the Warning, Error, and Fault level. If you input a log level into the Log Level of Configure SDK, you can check logs from that log level to the Fault level.

    Was this page helpful?

    Have any questions or suggestions?