AppsFlyer-AdRevenue 6.14.3

AppsFlyer-AdRevenue 6.14.3

由以下人员维护:Andrii HahanobivanskiyAmit kremerMargot GuettaMoris GatenoAmit Levy



  • Andrey

AppsFlyer 的 AdRevenue 项目

Version

目录

背景

通过归因广告收入,应用所有者能够全面了解用户 LTV 和活动 ROI。广告收入是通过在应用中展示奖励视频、优惠券墙、横幅和插页式广告来生成的。为了展示广告,广告变现网络 SDK 将集成到应用中。完成此操作后,您可以向应用用户展示广告并生成广告收入。

工作原理

AdRevenue 项目在广告变现网络 SDK 和 AppsFlyer SDK 之间进行调解。换句话说,您不再需要发送收入事件,我们将自己找到它!


|-------------------------------------------------------------------------|
|               |Application| + |Monetization network SDK|                |
|-------------------------------------------------------------------------|
                                   ▾
|-------------------------------------------------------------------------|
|                             |AdRevenue|                                 |
|-------------------------------------------------------------------------|
| |AdRevenue main module| + |AdRevenue monetization network SDK mediator| |
|-------------------------------------------------------------------------|
                                   ▾ 
|-------------------------------------------------------------------------|
|                            |AppsFlyer SDK|                              |
|-------------------------------------------------------------------------|

支持广告变现网络SDK

AdRevenue-Generic

要使用CocoaPods将AdRevenue集成到您的Xcode项目中,请在您的Podfile中指定它

pod 'AppsFlyer-AdRevenue'
@import AppsFlyerLib;
@import AppsFlyerAdRevenue;

...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Setup AppsFlyer
    [[AppsFlyerLib shared] setAppsFlyerDevKey:@"{dev-key}"];
    [[AppsFlyerLib shared] setAppleAppID:@"{apple-id}"];
    [[AppsFlyerLib shared] setIsDebug:YES];
 
    // Setup AppsFlyerAdRevenue
    [AppsFlyerAdRevenue start];
    [[AppsFlyerAdRevenue shared] setIsDebug:YES];
    //...
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    [[AppsFlyerLib shared] start];
}

在您的UIViewController中,您想向AdRevenue发送数据的指定

@import AppsFlyerAdRevenue;

logAdRevenue

允许您发送来自印象有效载荷的数据到AdRevenue,无论您使用哪个中介网络

NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
dictionary[kAppsFlyerAdRevenueCountry] = @"il"
dictionary[kAppsFlyerAdRevenueAdUnit] = @"02134568"
dictionary[kAppsFlyerAdRevenueAdType] = @"Banner"
dictionary[kAppsFlyerAdRevenuePlacement] = @"place"
dictionary[kAppsFlyerAdRevenueECPMPayload] = @"encrypt"
dictionary[@"foo"] = @"testcustom"
dictionary[@"bar"] = @"testcustom2"
    
[[AppsFlyerAdRevenue shared] logAdRevenueWithMonetizationNetwork:@"facebook"
                                                mediationNetwork:AppsFlyerAdRevenueMediationNetworkTypeAdMob
                                                    eventRevenue:@(0.026)
                                                 revenueCurrency:@"USD"
                                            additionalParameters:dictionary];

AdMob

要使用CocoaPods将AdRevenue集成到您的Xcode项目中,请在您的Podfile中指定它

pod 'AppsFlyer-AdRevenue-AdMob'
@import AppsFlyerLib;
@import AppsFlyerAdRevenue;
@import AppsFlyerAdRevenueAdMob;

...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Setup Google Ads
    [[GADMobileAds sharedInstance] startWithCompletionHandler:nil];
    
    // Setup AppsFlyer
    [[AppsFlyerLib shared] setAppsFlyerDevKey:@"{dev-key}"];
    [[AppsFlyerLib shared] setAppleAppID:@"{apple-id}"];
    [[AppsFlyerLib shared] setIsDebug:YES];
 
    // Setup AppsFlyerAdRevenue
    [AppsFlyerAdRevenue start];
    [[AppsFlyerAdRevenue shared] setIsDebug:YES];
    //...
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    [[AppsFlyerLib shared] start];
}

在您的UIViewController中,添加如下使用AdMob的地方

@import AppsFlyerAdRevenueAdMob;

Usage

AppsFlyerAdRevenueAdMob提供了一个API取代广告的setPaidEventHandler。您应该使用AppsFlyerAdRevenueAdMob API,而不是广告的API

+ (void)setPaidEventHandlerForTarget:(id)target
                            adUnitId:(NSString *)adUnitId
                        eventHandler:(AdMobEventHandler)eventHandler;

横幅

self.bannerView = [[GADBannerView alloc] initWithAdSize:GADAdSizeBanner;
//
// ...Banner configurations
//
[AppsFlyerAdRevenueAdMob setPaidEventHandlerForTarget:self.bannerView adUnitId:@"ca-app-pub-id" eventHandler:^(GADAdValue * _Nonnull value) {
        // do more actions with GADAdValue
}];

横幅广告

// ...Interstitial ad configurations
[AppsFlyerAdRevenueAdMob setPaidEventHandlerForTarget:interstitialAd adUnitId:@"ca-app-pub-id" eventHandler:^(GADAdValue * _Nonnull value) {
        // do more actions with GADAdValue
}];

原生广告

- (void)adLoader:(GADAdLoader *)adLoader didReceiveNativeAd:(GADNativeAd *)nativeAd {

    // <~+~ Use this api inside didReceivedNativeAd delegate ~+~>

    [AppsFlyerAdRevenueAdMob setPaidEventHandlerForTarget:nativeAd adUnitId:TestAdUnit eventHandler:^(GADAdValue * _Nonnull value) {
        // do more actions with GADAdValue
    }];
// ....
}

激励广告

// ...Rewarded ad configurations
self.rewardedAd = ad;
[AppsFlyerAdRevenueAdMob setPaidEventHandlerForTarget:[self rewardedAd] adUnitId:@"ca-app-pub-id" eventHandler:^(GADAdValue * _Nonnull value) {
    // do more actions with GADAdValue       
}];

应用打开

// ...App open ad configurations
self->_appOpenAd = appOpenAd;
[AppsFlyerAdRevenueAdMob setPaidEventHandlerForTarget:self->_appOpenAd adUnitId:@"ca-app-pub-id" eventHandler:^(GADAdValue * _Nonnull value) {
    // do more actions with GADAdValue       
}];