Google Analytics 4 (GA4)

    Airbridge supports integration with Google Analytics 4 (GA4). With the integration, you can send attribution data from Airbridge to GA4 and uncover insights into how users interact with your product in GA4.

    Note

    Only apps registered with GA4 can be integrated with Airbridge.

    Integration

    To implement the server-to-server integration, the App Instance ID of the Firebase Analytics SDK should be set as the device alias of the Airbridge SDK.

    Minimum SDK version required

    • Airbridge Android SDK: v.2.19.5

    • Airbridge iOS SDK: v.1.18.0

    • Airbridge React Native SDK: v.1.5.0

    • Airbridge Flutter SDK: v.3.0.2

    • Airbridge Unity SDK: v.1.9.0

    SDK setup

    Attention

    Once the SDK setup is complete, make sure to complete the required setup process in the Airbridge dashboard to implement the integration successfully.

    Add the codes below to the Airbridge SDK. Without adding the codes, GA4 won't be properly integrated with Airbridge even if the necessary setup is completed in the Airbridge dashboard.

    Android

    1234567891011121314151617181920212223242526
    // MainApplication.java
    @Override
    public void onCreate() {
        super.onCreate();
        // Initialize Airbridge SDK
        AirbridgeConfig config = new AirbridgeConfig.Builder("APP_NAME", "APP_TOKEN")
                // Make Airbridge SDK explicitly start tracking
                .setAutoStartTrackingEnabled(false)
                .build();
        Airbridge.init(this, config);
    
        // Set device alias into Airbridge SDK
        FirebaseAnalytics.getInstance(this).getAppInstanceId()
            .addOnCompleteListener(new OnCompleteListener<String>() {
                @Override
                public void onComplete(@NonNull Task<String> task) {
                    String appInstanceId = task.getResult();
                    if (appInstanceId != null) {
                        Airbridge.setDeviceAlias("ga4_app_instance_id", appInstanceId);
                    }
    
                    // Explicitly start tracking
                    Airbridge.startTracking();
                }
            });
    }

    iOS

    1234567891011121314151617
    import FirebaseAnalytics
    
    // AppDelegate.swift
    func application(
        _ application: UIApplication,
      didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]?
    ) {
      AirBridge.setAutoStartTrackingEnabled(false)
      AirBridge.getInstance("YOUR_APP_SDK_TOKEN", appName:"YOUR_APP_NAME", withLaunchOptions:launchOptions)
    
      if let appInstanceID = Analytics.appInstanceID() {
        AirBridge.state()?.setDeviceAlias(key:"ga4_app_instance_id", value: appInstanceID)
      }
        
      // Explicitly start tracking
      AirBridge.startTracking()
    }

    React Native

    Set autoStartTrackingEnabled to false in the airbridge.json.

    1
    import analytics from '@react-native-firebase/analytics';
    123
    const appInstanceId = await analytics().getAppInstanceId();
    Airbridge.state.setDeviceAlias("ga4_app_instance_id", appInstanceId);
    Airbirdge.state.startTracking();

    Flutter

    Set autoStartTrackingEnabled to false in the airbridge.json.

    12
    import 'package:firebase_core/firebase_core.dart';
    import 'package:firebase_analytics/firebase_analytics.dart';
    1234567
    final appInstanceId = await FirebaseAnalytics.instance.appInstanceId;
    
    if (appInstanceId != null) {
        Airbridge.state.setDeviceAlias("ga4_app_instance_id", appInstanceId);  
    }
    
    Airbridge.state.startTracking();

    Unity

    Set Auto Start Tracking Enabled to false in the project settings.

    12345678910
    private async void SetupAirbridgeIntegration()
    {
    #if UNITY_ANDROID || UNITY_IOS
    	string appInstanceId = await Firebase.Analytics.FirebaseAnalytics.GetAnalyticsInstanceIdAsync();
    	AirbridgeUnity.SetDeviceAlias("ga4_app_instance_id", appInstanceId);
                
    	// ... (에어브릿지 연동 코드를 여기에 추가해주세요)
    #endif
    	AirbridgeUnity.StartTracking();
    }

    Airbridge dashboard setup

    The Airbridge dashboard setup must be completed to implement the integration. For detailed instructions, refer to the user guide below.

    このページは役に立ちましたか?

    ご質問やご提案はありますか?