Mixpanel

Airbridge supports integration with Mixpanel. With the integration, you can send attribution data from Airbridge to Miaxpanel and uncover insights into how users interact with your product in Mixpanel.

Integration

To implement the server-to-server integration, the Device ID of the Mixpanel 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 Web SDK Loader: v.1.3.0

  • Airbridge React Native SDK: v.1.5.0

  • Airbridge Cordova SDK: v.2.0.2

  • 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, Mixpanel won't be properly integrated with Airbridge even if the necessary setup is completed in the Airbridge dashboard.

Android SDK (v4)

123456789101112131415
// MainApplication.kt
override fun onCreate() {
    super.onCreate()
    // Initialize Airbridge SDK
    val option = AirbridgeOptionBuilder("YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN")
        .setAutoStartTrackingEnabled(false)
        .build()
    Airbridge.initializeSDK(this, option)

    // Set device alias into Airbridge SDK
    Airbridge.setDeviceAlias("mixpanel_device_id", mixpanel.distinctId)
    
    // Explicitly start tracking
    Airbridge.startTracking()
}
12345678910111213141516
// MainApplication.java
@Override
public void onCreate() {
    super.onCreate();
    // Initialize Airbridge SDK
    AirbridgeOption option = new AirbridgeOptionBuilder("APP_NAME", "APP_TOKEN")
        .setAutoStartTrackingEnabled(false)
        .build();
    Airbridge.initializeSDK(application, option);
    
    // Set device alias into Airbridge SDK
    Airbridge.setDeviceAlias("mixpanel_device_id", mixpanel.getDistinctId());
    
    // Explicitly start tracking
    Airbridge.startTracking();
}

Android SDK (Previous)

123456789101112131415
// MainApplication.kt
override fun onCreate() {
    super.onCreate()
    // Initialize Airbridge SDK
    val config = AirbridgeConfig.Builder("YOUR_APP_NAME", "YOUR_APP_SDK_TOKEN")
        .setAutoStartTrackingEnabled(false)
        .build()
    Airbridge.init(this, config)

    // Set device alias into Airbridge SDK
    Airbridge.setDeviceAlias("mixpanel_device_id", mixpanel.distinctId)
    
    // Explicitly start tracking
    Airbridge.startTracking()
}
12345678910111213141516
// MainApplication.java
@Override
public void onCreate() {
    super.onCreate();
    // Initialize Airbridge SDK
    AirbridgeConfig config = new AirbridgeConfig.Builder("APP_NAME", "APP_TOKEN")
        .setAutoStartTrackingEnabled(false)
        .build();
    Airbridge.init(this, config);
    
    // Set device alias into Airbridge SDK
    Airbridge.setDeviceAlias("mixpanel_device_id", mixpanel.getDistinctId());

    // Explicitly start tracking
    Airbridge.startTracking();
}

iOS SDK (v4)

123456789101112131415161718
// AppDelegate.swift
func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {

    let option = AirbridgeOptionBuilder(name: "YOUR_APP_NAME", token: "YOUR_APP_SDK_TOKEN")
        .setAutoStartTrackingEnabled(false)
        .build()
    Airbridge.initializeSDK(option: option)

    Airbridge.setDeviceAlias(key: "mixpanel_device_id", value: Mixpanel.mainInstance().distinctId)
    
    // Explicitly start tracking
    Airbridge.startTracking()

    return true
}
12345678910111213141516171819
// AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    AirbridgeOptionBuilder* optionBuilder = 
        [[AirbridgeOptionBuilder alloc] initWithName:@"YOUR_APP_NAME"
                                               token:@"YOUR_APP_SDK_TOKEN"];

    [optionBuilder setAutoStartTrackingEnabled:NO];
    AirbridgeOption* option = [optionBuilder build];
    [Airbridge initializeSDKWithOption:option];

    [Airbridge setDeviceAliasWithKey:@"mixpanel_device_id" 
                               value:Mixpanel.mainInstance.distinctId];
    
    // Explicitly start tracking
    [Airbridge startTracking];

    return YES;
}

iOS SDK (Previous)

12345678910111213141516
// AppDelegate.swift
func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
  
    AirBridge.setAutoStartTrackingEnabled(false)
    AirBridge.getInstance("YOUR_APP_TOKEN", appName:"YOUR_APP_NAME", withLaunchOptions:launchOptions)

    AirBridge.state()?.setDeviceAlias(withKey:"mixpanel_device_id", value:Mixpanel.mainInstance().distinctId)
    
    // Explicitly start tracking
    AirBridge.startTracking()

    return true
}
12345678910111213141516
// AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    AirBridge.autoStartTrackingEnabled = NO;
    [AirBridge getInstance:@"YOUR_APP_SDK_TOKEN"
                   appName:@"YOUR_APP_NAME"
         withLaunchOptions:launchOptions];

    [AirBridge.state setDeviceAliasWithKey: @"mixpanel_device_id"
                                     value: Mixpanel.mainInstance.distinctId];

    // Explicitly start tracking
    [AirBridge startTracking];

    return YES;
}

123456
airbridge.init({
  ...
  autoStartTrackingEnabled: false,
})
airbridge.setDeviceAlias('mixpanel_device_id', mixpanel.get_distinct_id())
airbridge.startTracking()

React Native SDK (v4)

Set autoStartTrackingEnabled to false in the airbridge.json.

123
const appInstanceId = await Mixpanel.getDistinctId();
Airbridge.setDeviceAlias('mixpanel_device_id', appInstanceId);
Airbridge.startTracking();

React Native SDK (Previous)

Set autoStartTrackingEnabled to false in the airbridge.json.

12
Airbridge.state.setDeviceAlias("mixpanel_device_id", await Mixpanel.getDistinctId())
Airbirdge.state.startTracking()

Set autoStartTrackingEnabled to false in the airbridge.json.

12
Airbridge.state.setDeviceAlias("mixpanel_device_id", mixpanel.get_distinct_id())
Airbirdge.state.startTracking()

Flutter SDK (v4)

Set autoStartTrackingEnabled to false in the airbridge.json.

1234567
final appInstanceId = await mixpanel.getDistinctId();

if (appInstanceId != null) {
    Airbridge.setDeviceAlias("mixpanel_device_id", appInstanceId);
}

Airbridge.startTracking();

Flutter SDK (Previous)

Set autoStartTrackingEnabled to false in the airbridge.json.

12
Airbridge.state.setDeviceAlias("mixpanel_device_id", await mixpanel.getDistinctId())
Airbirdge.state.startTracking()

Unity SDK (v4)

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

12
Airbridge.SetDeviceAlias("mixpanel_device_id", Mixpanel.DistinctId);
Airbridge.StartTracking();

Unity SDK (Previous)

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

12
AirbridgeUnity.SetDeviceAlias("mixpanel_device_id", Mixpanel.DistinctId);
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.

Was this helpful?

Any questions or suggestions?