All Collections
3rd-party Integrations
Attribution
How can I connect Batch to AppsFlyer?
How can I connect Batch to AppsFlyer?

You can use AppsFlyer attribution data to improve your segmentation within Batch. The connection only requires a quick code addition.

Baptiste avatar
Written by Baptiste
Updated over a week ago

AppsFlyer is a mobile advertising attribution and analytics company. AppsFlyer helps marketers to pinpoint their targeting, optimize their ad spend and boost their ROI. 

On the other hand, Batch can receive information from AppsFlyer using their callbacks attribution. This will allow you to re-target your users with notifications based on the installation source.


Understanding how the connection works

Callbacks provided by AppsFlyer SDK allow you to sync AppsFlyer data with Batch SDK. You will be able to use Batch segmentation to target users based on install source attribution data.

iOS integration

After setting up the AppsFlyer attribution callback (iOS instructions on callbacks), you simply have to send to Batch the appropriate data via the SDK's method.

Here is an example of how you can set the callback in your app code (see more here):

-(void)onConversionDataReceived:(NSDictionary*) installData {
// initiate Batch user editor to set new attributes
BatchUserDataEditor *editor = [BatchUser editor];

[editor setAttribute:[installData objectForKey:@"media_source"] forKey:@"appsflyer_source"];
[editor setAttribute:[installData objectForKey:@"campaign"] forKey:@"appsflyer_campaign"];

// send new attributes to Batch servers [editor save];
}

Android integration

Similarly, you have to set up the AppsFlyer attribution callback (Android instructions) and send to Batch the attribution data via the SDK's method.

Here's an example of how you can set that callback in your app code (see more here):

AppsFlyerLib.getInstance().registerConversionListener(this, new AppsFlyerConversionListener() {

@Override
public void onInstallConversionDataLoaded(Map<String, String> conversionData) {
// initiate Batch user editor to set new attributes
BatchUserDataEditor editor = Batch.User.editor();

editor.setAttribute("appsflyer_source", conversionData.get("media_source"));
editor.setAttribute("appsflyer_campaign", conversionData.get("campaign"));

// send new attributes to Batch servers
editor.save();
}

});

What’s next?

Now, you can test your integration using our debug tool and find out if your data work properly on the Batch dashboard. 

Once your tests are finished,  you will be able to specify an installation source and more from the campaign editor:

It's now super easy to target users based on attribution 😉.


This article belongs to Batch's FAQ. Need more help? Find insightful articles, documentation, case & market studies, guides, and even more in our website's Resources section on batch.com and our blog.

Did this answer your question?