Unity SDK (v4)

Attention

This is a guide for installing and setting up the Unity SDK v4. For previous versions, refer to the Unity SDK guide (legacy).

Install the Airbridge SDK and implement the necessary settings following the steps below.

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 the Unity SDK Test.

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

  2. Select [Assets]>[Import Package]>[Custom Package ...] in Unity and add the downloaded package file.

  3. Once the package is added to Unity, the [AB180] tab will appear in the top menu bar.

Install Restricted SDK

Attention

Install only one version of the SDK, either the general SDK or the 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 Restricted Unity SDK.

  2. Select [Assets]>[Import Package]>[Custom Package ...] in Unity and add the downloaded package file.

  3. Once the package is added to Unity, the [AB180] tab will appear in the top menu bar.

Initialize SDK

Enter the correct App Name and App Token values in the SDK Settings window. The App Name and App Token can be found on the [Settings]>[Tokens] page in the Airbridge dashboard.

Configure SDK settings

Select [AB180]>[Airbridge Settings] from the top menu bar in Unity to open the SDK settings window. You may fill in the fields or click on the checkboxes that are necessary for your service.

Configure ATT prompt

Note

The functions necessary to ensure compliance with privacy policies should be reviewed with legal counsel.

In the iOS environment, the IDFA can only be collected when users consent to data tracking through the AppTrackingTransparency (ATT) prompt.

Event collection should be delayed until the user allows tracking. If the install event is collected before the user allows tracking through the ATT prompt, the install event data will lack an identifier, making performance measurement difficult. We recommend setting a sufficient delay time for event collection to collect identifiers.

1. Prepare the text you will use in the ATT prompt.

2. Provide the ATT prompt following this guide provided by Apple.

3. If the install event is not collected, the Airbridge React Native SDK delays collecting install events for 30 seconds until the user allows tracking each time the app is launched. If the user exits the app before deciding whether to allow tracking, the SDK will not collect the install event and will try again at the next app launch.

In the SDK settings, configure the iOS Tracking Authorize Timeout Seconds to set a sufficient delay time for collecting install events. The default value is 300 seconds, and it can be set up to 3600 seconds (1 hour).

Attention

Set a sufficient delay time to collect the app install event. If the SDK collects install events before users can allow tracking on the ATT prompt, the IDFA will not be collected along with the install events.

Opt-in setup

Attention

Optional settings. Configure only if necessary.

The opt-in policy requires user consent before using user data.

After setting the Auto Start Tracking Enabled in the SDK settings to false, call the StartTracking function at the point of time when you can collect events. The SDK will start collecting events when the startTracking function is called.

1
Airbridge.StartTracking();

Opt-out setup

Attention

Optional settings. Configure only if necessary.

The opt-out policy allows the use of user information until the user explicitly declines.

After setting the Auto Start Tracking Enabled in the SDK settings to true, call the StopTracking function at the point of time when you can no longer collect events. The SDK will stop collecting events when the stopTracking function is called.

1
Airbridge.StopTracking();

SDK Signature

Attention

Optional settings. Configure only if necessary.

With the SDK Signature, you can prevent SDK spoofing and use verified events to measure ad performance.

The SDK Signature credentials, which are the Secret ID and the Secret, are required for the SDK Signature setup. They can be found on the [Management]>[Fraud Validation Rules]>[SDK Signature] page in the Airbridge dashboard. For more details on how to find the SDK Signature credentials, refer to this Airbridge guide.

Once you have the credentials, go to the SDK settings and enter the Secret ID as sdkSignatureID and the Secret as sdkSignatureSecret.

Deep Linking

Deep linking allows you to redirect users from ads to specific locations within your app. The data collected from the tracking link enables you to monitor the performance of the deep link in Airbridge.

When a user clicks on the Airbridge tracking link, the scheme deep link embedded in the tracking link is converted into an Airbridge Deep Link, which can be either an HTTP deep link or a scheme deep link. This Airbridge Deep Link redirects the user to the desired app location. Then, the Airbridge SDK converts the Airbridge Deep Link back to the original scheme deep link embedded in the tracking link and passes it to the app.

  • Example scheme deep link embedded in the tracking link: YOUR_SCHEME://product/12345

  • Examples of Airbridge Deep Links

    • HTTP deep link format 1: https://YOUR_APP_NAME.airbridge.io/~~~

    • HTTP deep link format 2: https://YOUR_APP_NAME.abr.ge/~~~

    • Scheme deep link format: YOUR_SCHEME://product/12345?airbridge_referrer=~~~

When the app is installed on the device and the tracking link is clicked, the app opens through the Airbridge Deep Link. The Airbridge SDK converts the Airbridge Deep Link into the scheme deep embedded in the tracking link and passes it to the app.

When the app is not installed on the device and the tracking link is clicked, the Airbridge SDK saves the Airbridge Deep Link is saved. After the user is redirected to the app store or website and the app is installed and launched, the Airbridge SDK converts the saved Airbridge Deep Link into the scheme deep embedded in the tracking link and passes it to the app.

Set up deep linking

For the deep linking setup, the following information is required.

  • Deep link information submitted in the Airbridge dashboard

  • In-app location address for user redirection

First, submit the deep link information to the Airbridge dashboard.

After entering the deep link information into the Airbridge dashboard, an additional setup is required to enable the following.

  • App launch with Airbridge Deep Links

  • Airbridge deep link event collection

  • User redirection with Airbridge Deep Links

For detailed instructions, refer to the information below.

Set up deferred deep linking

When a user clicks on a tracking link with deferred deep linking capabilities and the app is not installed on the device, the Airbridge SDK collects the deep link as follows.

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

In-app events

The Airbridge SDK collects user actions from the app as per settings and sends them as in-app events.

Send in-app events

SDK setup for hybrid apps

You can set up the Unity SDK to handle Airbridge-related tasks within the in-app website without changing the website's code for your hybrid app.

The Airbridge.TrackEvent function must be called to send events. Refer to the information below about the required Airbridge.TrackEvent function components and their types.

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

Refer to the component definition and available strings 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" } },
    }
);

Additional in-app event settings

Attention

The default settings will apply if no additional settings are configured. Proceed after reviewing whether additional settings are necessary.

Configure additional settings for sending in-app events if necessary.

Example codes

Airbridge collects in-app events that are classified as Standard Events and Custom Events. Standard Events are events predefined by Airbridge. Refer to the example codes below.

Custom Events are events defined by Airbridge users to track user actions that are unique to their services. 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 Data

Airbridge sends user data along with events. User data allows for a more accurate ad performance measurement.

Set User ID

User IDs refer to the user identifier used in a service. User IDs should be unique IDs that can identify unique users across websites and apps.

#{"width":"140px"}

Function

#{"width":"240px"}

Description

Airbridge.SetUserID

Inputs the user ID.

Airbridge.ClearUserID

Deletes the user ID.

Airbridge.SetUserAlias

Adds additional user identifiers. Up to 10 items can be added.

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

- value: Up to 1024 characters.

Airbridge.RemoveUserAlias

Deletes only specified identifiers.

Airbridge.ClearUserAlias

Deletes all additional user identifiers.

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

Send additional user information

Attention

Sensitive user information may be included. Send after a thorough review with a legal advisor.

Refer to the functions below to send additional user information.

#{"width":"140px"}

Function

#{"width":"240px"}

Description

Airbridge.SetUserEmail

Inputs user's email. The data is hashed using SHA256.

Airbridge.ClearUserEmail

Deletes the user email.

Airbridge.SetUserPhone

Inputs user's phone number. The data is hashed using SHA256.

Airbridge.ClearUserPhone

r.

Airbridge.SetUserAttribute

Adds additional user attributes. Up to 100 items can be added.

- key: Up to 128 characters. 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

Deletes only specified attributes from the additional attributes.

Airbridge.ClearUserAttributes

Deletes 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 User Info Hash Enabled is set to false in the SDK settings, user emails and phone numbers are passed without being hashed. The default setting is true.

Clear user data

You can reset user information with the Airbridge.clearUser function.

1
Airbridge.ClearUser();

Additional SDK settings

Follow the instructions below for additional setup.

Attention

Optional settings. Configure only if necessary.

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

When you set up the Airbridge SDK to use tracking links within apps, every time a tracking link is used within the app, Deeplink Pageviews are aggregated as Target Events. The deep link performance may be affected when Deeplink Pageviews occur frequently right after Deeplink Opens.

The attribution window for Deeplink Pageviews is set to 3 days by default. If you want to change the attribution window for Deeplink Pageviews, contact your Airbridge CSM. If you don't have a designated CSM, contact the Airbridge Help Center.

Get Attribution Results

Attention

It takes some time for the Airbridge SDK to collect attribution results. We do not recommend using attribution results for functionalities requiring real-time processing.

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 deep link events when the app is opened through a deep link, even if the deep link is not an Airbridge Deep Link. Configure Track Airbridge Link Only in the SDK Settings to true to collect deep link events only if the app is opened through an Airbridge Deep Link and prevent unnecessary event collection.

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.

Note

Airbridge cannot provide guidance on storing the user consent data and implementing the prompts. For assistance, consult legal professionals.

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.

Attention

Ensure to follow the instructions below.

  • Use the field names specified by Airbridge: eea, adPersonalization, adUserData

  • Input 0 or 1 following the consent data collected.

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

Attention

If the SDK is not enabled immediately after the SDK initialization, the Install, Open, and Deeplink Openbvevents may not be collected.

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?