By attributing ad revenue, app owners gain the complete view of user LTV and campaign ROI. Ad revenue is generated by displaying ads on rewarded videos, offer walls, interstitials, and banners in an app. To display ads, ad monetization network SDKs are integrated into the app. Having done so you are able to serve ads to your app users and generate ad revenue.
The AdRevenue project mediates between the ad monetization network SDK and the AppsFlyer SDK. In other words, you no longer need to send a revenue event, we will find it ourselves!
|-------------------------------------------------------------------------|
| |Application| + |Monetization network SDK| |
|-------------------------------------------------------------------------|
▾
|-------------------------------------------------------------------------|
| |AdRevenue| |
|-------------------------------------------------------------------------|
| |AdRevenue main module| + |AdRevenue monetization network SDK mediator| |
|-------------------------------------------------------------------------|
▾
|-------------------------------------------------------------------------|
| |AppsFlyer SDK| |
|-------------------------------------------------------------------------|
Add to your Podfile and run pod install
:
pod 'AppsFlyer-AdRevenue'
Adding The Connector To Your Project via Swift Package Manager
-
Add a Swift Package File
- In your Xcode project, go to File > Swift Packages > Add Package Dependency.
-
Enter Package Repository URL
- In the dialog that appears, enter the URL of the repository that hosts the adrevenue-apple-sdk package:
https://github.com/AppsFlyerSDK/adrevenue-apple-sdk.git
Note: as AdRevenueConnector has a dependency on AppsFlyerLib framework v6.12.1 , please, make sure to integrate it as well for SPM.
@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];
}
In your UIViewController, where you want to send data to AdRevenue specify following:
@import AppsFlyerAdRevenue;
Allow you send data from the impression payload to AdRevenue no matter which mediation network you use:
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];