[WIP] Flutter SDK (v4) (Beta)

    Pub Version

    Attention

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

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

    Install SDK

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

    Please add the following line to the dependencies block in the pubspec.yaml file.

    123
    dependencies:
      # Get the latest version from https://pub.dev/packages/airbridge_flutter_sdk/versions
      airbridge_flutter_sdk: HERE_LATEST_VERSION

    Open the Terminal at the top location of the project and run the following command.

    Airbridge Flutter SDK only works on Flutter 1.20.0 and above, Dart 2.12.0 and above.

    Shell
    1
    flutter pub get

    Restricted SDK

    Attention

    Install only one version of the SDK, either the general SDK or the restricted SDK.

    Depending on policies and environment, there may be a need to restrict the collection of Device IDs such as GAID, IDFA. If you install the Restricted SDK, the Airbridge SDK will not collect device IDs such as GAID, IDFA.

    Please install the Restricted SDK according to the method below.

    123
    dependencies:
      # Get the latest version from https://pub.dev/packages/airbridge_flutter_sdk_restricted/versions
      airbridge_flutter_sdk_restricted: HERE_LATEST_VERSION

    Please add the following line to the dependencies block in the pubspec.yaml file.

    Open the Terminal at the top location of the project and run the following command.

    Shell
    1
    flutter pub get

    Initialize SDK

    The initialization methods for iOS and Android SDKs are different. Please refer to the guides below.

    The YOUR_APP_NAME and YOUR_APP_SDK_TOKEN can be found on the [Settings]>[Tokens] page in the Airbridge dashboard.

    iOS

    Add the following code to the ios/YOUR_PROJECT_NAME/AppDelegate.m file.

    12345678
    import airbridge_flutter_sdk
    
    override func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
      ) -> Bool {
        AirbridgeFlutter.initializeSDK(appName: "YOUR_APP_NAME", appToken: "YOUR_APP_SDK_TOKEN")
    }

    Android

    If an Application class is not defined in the relevant project Android module, then create an Application class.

    Add the following code to the android/app/src/main/java/.../MainApplication.kt file

    123456789
    import co.ab180.airbridge.flutter.AirbridgeFlutter
    import io.flutter.app.FlutterApplication
    
    class MainApplication: FlutterApplication() {
        override fun onCreate() {
            super.onCreate()
            AirbridgeFlutter.initializeSDK(this, "YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN")
        }
    }

    Please register the previously created Application class in the AndroidManifest.xmlof the corresponding project's android module as follows.

    12345
    <application
        android:name=".MainApplication"
        ...>
        ...
    </application>

    Configure SDK

    Enter the configuration values to use the Airbridge Flut SDK.

    123456789101112131415161718
    {
        "sdkEnabled": boolean,
        "logLevel": "debug" | "info" | "warning" | "error" | "fault",
        "autoStartTrackingEnabled": boolean,
        "autoDetermineTrackingAuthorizationTimeoutInSecond": number,
        "trackMetaDeferredAppLinkEnabled": boolean,
        "sessionTimeoutInSecond": number,
        "metaInstallReferrerAppID": string,
        "trackAirbridgeDeeplinkOnlyEnabled": boolean,
        "trackInSessionLifecycleEventEnabled": boolean,
        "hashUserInformationEnabled": boolean,
        "sdkSignatureID": string,
        "sdkSignatureSecret": string,
        "clearEventBufferOnInitializeEnabled": boolean,
        "eventBufferCountLimit": number,
        "eventBufferSizeLimitInGibibyte": number,
        "eventTransmitIntervalInSecond": number,
    }

    1. Create an airbridge.json file at the top level of the Flutter project folder and input the JSON as above.

    2. Don't enter the key values for settings that are not needed.

    Refer to the guides listed below for the settings values.

    123
    flutter:
      assets:
        - assets/airbridge.json

    Configure ATT Prompt

    Note

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

    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 React Native 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 autoDetermineTrackingAuthorizationTimeout of Configure SDK can be used to set a longer delay for collecting installation events. The default setting for the autoDetermineTrackingAuthorizationTimeout is 300 seconds. It can be set up to a maximum of 3600 seconds (1 hour).

    Attention

    Sufficient time must be configured to delay the collection of install events. If the delay time is up, the SDK will collect install events without identifiers before users can allow tracking on the ATT prompt.

    SDK Opt-In

    Attention

    The instructions below are optional. Proceed only if necessary.

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

    After setting the autoStartTrackingEnabled 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.

    123
    import 'package:airbridge_flutter_sdk/airbridge_flutter_sdk.dart';
    ...
    Airbridge.startTracking();

    SDK Opt-Out

    Attention

    The instructions below are optional. Proceed only if necessary.

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

    After setting the autoStartTrackingEnabled 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.

    123
    import 'package:airbridge_flutter_sdk/airbridge_flutter_sdk.dart';
    ...
    Airbridge.stopTracking();

    SDK Signature

    Attention

    The instructions below are optional. Proceed only if necessary.

    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 sdkSignatureID of Configure SDK

    2. Enter the sdkSignatureSecret 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, 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 Flutter 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
    static void trackEvent({
        required String category,
        Map<String, dynamic>? semanticAttributes,
        Map<String, dynamic>? customAttributes
    })

    Component

    Required

    Type

    Description

    category

    Required

    String

    Categories in Events

    semanticAttributes

    Optional

    Map<String, dynamic>

    Semantic attributes for events

    customAttributes

    Optional

    Map<String, dynamic>

    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.

    123456789101112131415
    import 'package:airbridge_flutter_sdk/airbridge_flutter_sdk.dart';
    
    Airbridge.trackEvent(
        category: 'event',
        semanticAttributes: {
            AirbridgeAttribute.VALUE: 10
        },
        customAttributes: {
            'string': 'string',
            'number': 1000,
            'boolean': true,
            'object': {'key': 'value'},
            'array': ['value'],
        }
    );

    Set 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.

    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.

    123456789101112131415
    import 'package:airbridge_flutter_sdk/airbridge_flutter_sdk.dart';
    ...
    Airbridge.trackEvent(
        category: 'event',
        semanticAttributes: {
            AirbridgeAttribute.VALUE: 10,
        },
        customAttributes: {
            'string': 'string',
            'number': 1000,
            'boolean': true,
            'object': {'key': 'value'},
            'array': ['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.

    123456789
    import 'package:airbridge_flutter_sdk/airbridge_flutter_sdk.dart';
    ...
    // identifier
    Airbridge.setUserID('string');
    Airbridge.clearUserID();
    // addtional identifier
    Airbridge.setUserAlias(key: 'string', value: 'string');
    Airbridge.removeUserAlias('string');
    Airbridge.clearUserAlias();

    Set Additional User Information

    Attention

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

    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.

    123456789101112
    import 'package:airbridge_flutter_sdk/airbridge_flutter_sdk.dart';
    ...
    // email, phone
    Airbridge.setUserEmail('string');
    Airbridge.clearUserEmail();
    Airbridge.setUserPhone('string');
    Airbridge.clearUserPhone();
    // addtional attribute
    Airbridge.setUserAttribute(key: 'string', value: 'string');
    Airbridge.setUserAttribute(key: 'number', value: 1000);
    Airbridge.removeUserAttribute('string');
    Airbridge.clearUserAttributes();

    Hash user information

    When the hashUserInformationEnabled 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.

    123
    import 'package:airbridge_flutter_sdk/airbridge_flutter_sdk.dart';
    ...
    Airbridge.clearUser();

    Additional SDK settings

    You can additionally set up the Flutter SDK.

    Attention

    The instructions below are optional. Proceed only if necessary.

    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

    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.

    123
    Airbridge.setAttributionListener((result) { 
        // do something
    });

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

    After clicking on the push notification, you need to pass the deep link information in the payload to the Airbridge SDK to collect deep link events. Please set it with the Airbridge.trackDeeplink function.

    iOS

    Add the following code to the ios/YOUR_PROJECT_NAME/AppDelegate.m file.

    12345678910111213141516171819202122232425262728
    import Airbridge
    
    func application(
        _ application: UIApplication,
        didReceiveRemoteNotification userInfo: [AnyHashable : Any],
        fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void
    ) {
        if UIApplication.shared.applicationState == .inactive {
            let url = // 푸시 알림 페이로드의 딥링크
    
            Airbridge.trackDeeplink(url)
        }
    }
    
    func userNotificationCenter(
        _ center: UNUserNotificationCenter,
        didReceive response: UNNotificationResponse,
        withCompletionHandlercompletionHandler: @escaping () -> Void
    ) {
        if 
            UIApplication.shared.applicationState == .inactive || UIApplication.shared.applicationState == .background,
            response.actionIdentifier == UNNotificationDefaultActionIdentifier
        {
            let url = // 푸시 알림 페이로드의 딥링크
    
            Airbridge.trackDeeplink(url)
        }
    }

    Android

    You do not need to make any separate settings because it is automatically collected on Android.

    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 trackAirbridgeDeeplinkOnlyEnabled 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 trackInSessionLifecycleEventEnabled 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 autoStartTrackingEnabled of Configure SDK to false.

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

    注意

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

    • 请根据同意情况正确输入 01

    12345678910
    import 'package:airbridge_flutter_sdk/airbridge_flutter_sdk.dart';
    ...
    // deliver informations to sdk using device alias
    // based on actual region
    Airbridge.setDeviceAlias(key: 'eea', value: '0' or '1');
    // based on actual user consent
    Airbridge.setDeviceAlias(key: 'adPersonalization', value: '0' or '1');
    Airbridge.setDeviceAlias(key: 'adUserData', value: '0' or '1');
    // start tracking explicitly
    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 (iOS), Meta Ads guide (Android).

    2. Set the trackMetaDeferredAppLinkEnabled of Configure SDK to true.

    Initialize the Airbridge SDK in Deactivation Mode

    Attention

    If the Airbridge SDK is not activated immediately after initialization, the Install, Open, Deep link events may not be collected.

    Initializing the Airbridge SDK enables all features. You can initialize the Airbridge SDK with all features disabled by setting the sdkEnabled 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.

    12345
    import 'package:airbridge_flutter_sdk/airbridge_flutter_sdk.dart';
    ...
    Airbridge.isSDKEnabled();
    Airbridge.enableSDK();
    Airbridge.disableSDK();

    Meta Install Referrer collection settings

    This is a setting needed for collecting Meta Install Referrer. You send the meta app ID to the metaInstallReferrer 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 logLevel of Configure SDK, you can check logs from that log level to the Fault level.

    Was this page helpful?

    Have any questions or suggestions?