Integrate Impression-Level Revenue Data
Before you start
Make sure you have integrated OpenMediation SDK v2.1.0 or higher.
ILRD Data
The ILRD Data is returned as part of the ImpressionData object. Here’s a list of the relevant data fields, including description and type.
Field Name | Datatype | Description |
---|---|---|
impression_id | String | A unique ID for each impression |
instance_id | String | Identifier per network, this includes the ad network’s instanceID/placement/zone/etc. |
instance_name | String | The ad network instance name as defined on the platform |
instance_priority | Integer | The instance priority in mediation rule |
ad_network_name | String | The ad network name that served the ad |
ad_network_unit_id | String | The ad unit displayed (Rewarded Video/Interstitial/Banner/Native/Splash/Cross Promote) |
mediation_rule_id | String | The id of mediation rule |
mediation_rule_name | String | The name of mediation rule |
mediation_rule_type | String | The type of mediation rule: Manual or Auto |
mediation_rule_priority | Integer | The priority of mediation rule |
placement_id | String | Ad Placement ID |
placement_name | String | Ad Placement Name |
placement_ad_type | String | Ad Placement Type: Banner/Native/Rewarded Video/Interstitial/Splash/CrossPromote |
scene_name | String | Scene Name, null for Banner/Native/Splash |
currency | String | Is always "USD" |
revenue | Double | The revenue generated for the impression (USD). The revenue value is either estimated or exact, according to the precision (see precision field description) |
precision | String | The source value of the revenue field: undisclosed - non-public data, for example, FAN requires not to store revenue data exact - exact value, generally the benefit brought by in-app bidding type instance estimated - estimated value, estimated from the historical income data of ordinary instance |
ab_group | String | Indication if A/B test was activated via platform |
lifetime_value | Double | The accumulated value of the user ad revenue |
Step 1. Add the Delegate
OpenMediation SDK currently provides a protocol callback method to notify users about the data information of the displayed advertisement. To get your presentation data through OpenMediation SDK, you need to add the following code to your application before you can receive presentation data callbacks.
Step 2. Get the ImpressionData
Implement the following callback function in the code to receive the relevant data of the advertisement display callback.
- (void)omImpressionData:(OMImpressionData *)impressionData error:(NSError *)error{
if(!error){
NSLog(@"Get ImpressionData");
}
}
func omImpressionData(_ impressionData: OMImpressionData?, error: Error?){
if (error == nil) {
print("Get ImpressionData")
}
}
Step 3. Remove Delegate
If you want to remove the ImpressionData listener from your application, you can do it using the removeImpressionDataDelegate API.
Send Data to Other Tools or Vendors
Once you receive impression data, you can feed it to your internal Business Intelligence (BI) tools, or send it to third-party attribution and analytics providers for further analysis.
Example
The example below shows how to send ILRD to Google Analytics for Firebase. You can use it as is, or make any required changes, in order to integrate with 3rd party reporting tools or your own proprietary optimization tools and databases.
- (void)omImpressionData:(OMImpressionData *)impressionData error:(NSError *)error{
if(!error){
[FIRAnalytics logEventWithName:kFIREventAdImpression
parameters:@{
kFIRParameterAdPlatform:@"OpenMediation",
kFIRParameterAdUnitName:impressionData.placementName,
kFIRParameterAdFormat:impressionData.placementAdType,
kFIRParameterValue:impressionData.revenue,
kFIRParameterCurrency:impressionData.currency,
kFIRParameterAdSource:impressionData.adNetworkName,
@"precision":impressionData.precision
}];
}
}
func omImpressionData(_ impressionData: OMImpressionData?, error: Error?){
if (error == nil) {
Analytics.logEvent(AnalyticsEventAdImpression, parameters: [
AnalyticsParameterAdPlatform: "OpenMediation",
AnalyticsParameterAdUnitName: impressionData!.placementName,
AnalyticsParameterAdFormat: impressionData!.placementAdType,
AnalyticsParameterValue: impressionData!.revenue,
AnalyticsParameterCurrency: impressionData!.currency,
AnalyticsParameterAdSource: impressionData!.adNetworkName,
"precision": impressionData!.precision
])
}
}
Comments
Article is closed for comments.