Facebook App安装广告 - sdk中的数据

时间:2016-07-05 12:26:00

标签: ios facebook facebook-ads-api appsflyer appsflyer-ios-sdk

我已经安装了Facebook SDK,以及Appsflyer和Mixpanel。问题是,当用户通过Facebook安装应用程序时,我需要某些数据。我需要的数据是广告组,关键字(如果可能)和广告系列名称/ ID。我似乎无法弄清楚如何获得它。我已经检查了SDK documentationAds-Helper tools以及Ads-SDK documentation

我希望SDK能够在第一次启动应用时向我提供数据,但我似乎无法找到有关它的文档。

启动时如何在应用中获取广告数据?我可以从facebook sdk获取,还是应该从Appsflyer获取?

1 个答案:

答案 0 :(得分:0)

您需要实施AppsFlyerTrackerDelegate。您应该从installData字典中获取所需信息(或至少是广告系列ID)。

请参阅此代码:

SelectedIndex

输出:

- (BOOL)application:(UIApplication ​*)application didFinishLaunchingWithOptions:(NSDictionary*​)launchOptions {
   [AppsFlyerTracker sharedTracker].appsFlyerDevKey = @"[MY_DEV_KEY]";
   [AppsFlyerTracker sharedTracker].appleAppID = @"id123456789";

// Load conversion data and deep-link tracking

   [AppsFlyerTracker sharedTracker].delegate = self;

   return YES;
}

-(void)applicationDidBecomeActive:(UIApplication *)application
{
   [[AppsFlyerTracker sharedTracker] trackAppLaunch];
}
-(void)onConversionDataReceived:(NSDictionary*) installData {

    id status = [installData objectForKey:@"af_status"];
    if([status isEqualToString:@"Non-organic"]) {
        id sourceID = [installData objectForKey:@"media_source"];
        id campaign = [installData objectForKey:@"campaign"];
        NSLog(@"This is a none organic install. Media source: %@  Campaign: %@",sourceID,campaign);
    } else if([status isEqualToString:@"Organic"]) {
        NSLog(@"This is an organic install.");
    }
}
-(void)onConversionDataRequestFailure:(NSError *) error {
    NSLog(@"%@",error);
}

https://support.appsflyer.com/hc/en-us/articles/207032096-Accessing-AppsFlyer-Attribution-Conversion-Data-from-the-SDK-iOS-Deferred-Deeplinking-