Integrate Impression-Level Revenue Data
Before you begin
- Make sure you have integrated OpenMediation Unity Package v2.1.0 or higher.
- Make sure you have integrated OpenMediation Android or iOS 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 |
Implement the ImpressionData Listener
The OpenMediation SDK fires post backs 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 using the ILRD data itself.
If you want to add the ImpressionData listener to your application, make sure you declare the listener before initializing the OpenMediation SDK, to avoid any loss of information.
The OpenMediation SDK will notify your listener of the success post-backs, related to impression data. The onImpressionDataCallback is described below:
void Start() {
OmEvents.onImpressionDataCallback += ImpressionData;
OmEvents.onImpressionDataErrorCallback += ImpressionDataError;
}
void ImpressionData(OmImpressionData impressionData) {
// To make it easy to use, you can refer to each field separately, or get all information using the allData method:
if (impressionData != null) {
string allData = impressionData.allData;
string adNetworkName = impressionData.adNetworkName;
double? revenue = impressionData.revenue;
}
}
void ImpressionDataError(string error) {
}
Note that impression data will always be null unless you have enabled ILRD with your OpenMediation account representative.
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 ImpressionData(OmImpressionData impressionData) {
if (impressionData != null) {
// Feed impression data into internal tools or send to third-party analytics
Firebase.Analytics.Parameter[] impressionParameters = new[] {
new Firebase.Analytics.Parameter("ad_platform", "OpenMediation"),
new Firebase.Analytics.Parameter("ad_source", impressionData.adNetworkName),
new Firebase.Analytics.Parameter("ad_unit_name", impressionData.placementName),
new Firebase.Analytics.Parameter("ad_format", impressionData.placementAdType),
new Firebase.Analytics.Parameter("value", impressionData.revenue),
new Firebase.Analytics.Parameter("currency", impressionData.currency),
new Firebase.Analytics.Parameter("precision", impressionData.precision)
};
Firebase.Analytics.FirebaseAnalytics.LogEvent("ad_impression", impressionParameters);
}
}
Comments
Please sign in to leave a comment.