Google Analytics 4(GA4)

Airbridge supports integration with Google Analytics 4(GA4). With the integration, attribution data are passed from Airbridge to GA4, allowing you to leverage the attribution data to uncover in-depth insights into how users interact with your product in GA4.

Airbridge ↔ GA4 Integration

For the GA4 integration, it is required to set GA4 SDK's Device ID as Airbridge SDK's Device Alias. After setting Device Alias and enabling GA4 integration on the Airbridge dashboard, the Event collected from Airbridge SDK and attribution data will be sent to GA4 via Server to Server.

Minimum SDK Version

  • Airbridge Android SDK: 2.19.5

  • Airbridge iOS SDK: 1.18.0

  • Airbridge React Native SDK: 1.5.0

  • Airbridge Flutter SDK: 3.0.2

  • Airbridge Unity SDK: 1.9.0

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

Integration - 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()
}

Integration - React Native

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

Attention

For the integration, set the autoStartTrackingEnabled option from airbridge.json as false.

Integration - Flutter

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

Attention

For the integration, set the autoStartTrackingEnabled option from airbridge.json as false.

Integration - Unity

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

Attention

For the integration, set the 'autoStartTrackingEnabled' option from Project Setup as 'false'.

Was this page helpful?

Have any questions or suggestions?