Impression-level revenue integration for iOS
Integrate impression-level revenue data into your analytics platform by using the Impression Level Revenue (ILR) SDK API.
阅读时间2 分钟最后更新于 4 天前
Prerequisites
Ensure that you have correctly integrated the LevelPlay SDK 7.0.3+ into your application. Refer to iOS SDK integration. For more information about the Impression Level Revenue (ILR) SDK feature and pre-requisites, refer to Impression-level revenue server-side API.Implement the ImpressionData Listener
The LevelPlay SDK fires postbacks to inform you about the displayed ad. The ImpressionData listener is an optional listener that you can implement to receive impression data. This listener will provide you with information about all ad units, and you'll be able to identify the different ads by using the impression level revenue. To add the ImpressionData listener to your application, declare the listener before initializing the LevelPlay SDK to avoid any loss of information.+ (void)addImpressionDataDelegate:(id<LPMImpressionDataDelegate>)delegate;
- (void)impressionDataDidSucceed:(LPMImpressionData *)impressionData;
Remove Impression Data Listener
To remove the ImpressionData listener from your application, use the removeImpressionData API:+ (void)removeImpressionDataDelegate:(id<LPMImpressionDataDelegate>)delegate;
Integrate the ILR data
After you implement the ImpressionDataListener, you can send the impression data to your own proprietary BI tools and DWH or integrate it with third-party tools.
You can refer to each field separately or get all information by using the allData method:
- (void)impressionDataDidSucceed:(LPMImpressionData *)impressionData { NSNumber *revenue = impressionData.revenue; NSString *ad_network = impressionData.adNetwork; NSDictionary *all_data = impressionData.allData;}
/** Invoked when the ad was displayed successfully and the impression data was recorded **/- (void)impressionDataDidSucceed:(LPMImpressionData *)impressionData { NSLog(@"%s", __PRETTY_FUNCTION__); [FIRAnalytics logEventWithName:kFIREventAdImpression parameters:@{ kFIRParameterAdPlatform:@"LevelPlay", kFIRParameterAdSource:(impressionData.ad_network ?: @"No ad_network"), kFIRParameterAdFormat:(impressionData.ad_format ?: @"No ad_format"), kFIRParameterAdUnitName:(impressionData.instance_name ?: @"No instance_name"), kFIRParameterCurrency:@"USD", kFIRParameterValue:(impressionData.revenue ?: @0) }];}