ILRD
With Impression Level revenue data (ILRD), you can track and collect ad data.
|
Parent class |
Method |
|
InterstitialAdEventListener |
|
|
NativeAdEventListener |
|
|
RewardedAdEventListener |
|
|
BannerAdEventListener |
|
Each of these methods has the ImpressionData parameter with a single method, getRawData. This method returns a JSON string with ILRD (see the table below).
Note
The HandleImpression method is only triggered after the ad impression is counted.
[Serializable]
public class ImpressionDataModel
{
public string ad_unit_id;
public string adType;
public string currency;
public string revenue;
public string revenueUSD;
public string precision;
public NetworkData network;
}
[Serializable]
public class NetworkData
{
public string name;
public string ad_unit_id;
}
class ExampleBannerAdEventListener : BannerAdEventListener {
// ...
private void HandleImpression(object sender, ImpressionData impressionData) =>
{
var data = impressionData == null ? "null" : impressionData.rawData;
try
{
var parsedData = Newtonsoft.Json.JsonConvert.DeserializeObject<ImpressionDataModel>(data);
var adUnitId = parsedData.ad_unit_id;
var adType = parsedData.adType;
var currency = parsedData.currency;
var revenue = parsedData.revenue;
var revenueUSD = parsedData.revenueUSD;
var precision = parsedData.precision;
var networkName = parsedData.network.name;
var networkAdUnitId = parsedData.network.ad_unit_id;
}
catch (Exception ex)
{
Debug.LogError($"Error parsing impression data: {ex.Message}");
}
}
}
Available data
You can parse rawData to obtain the following information:
|
Key |
Type |
Description |
|
|
string |
A unique ad unit ID. |
|
|
string |
The type of an ad:
|
|
|
string |
The currency that an ad network uses. |
|
|
string |
Revenue from an impression in the ad network currency. The currency specified in the |
|
|
string |
Revenue from an impression, converted to USD. |
|
|
string |
The accuracy of the
|
|
|
string |
The name of the ad network that served the impression. |
|
|
string |
A unique ad unit ID in the network that served the ad. |