Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Integrate Appsflyer with Batch.com SDK

Integrate Appsflyer with the Batch.com SDK on Android

Full documentation on attribution callbacks.

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

});

Integrate Appsflyer with the Batch.com SDK on iOS

Full documentation on attribution callbacks.

-(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];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.