ILRD
通过展示层级收入数据 (ILRD),您可以追踪并收集广告数据。
|
父类 |
方法 |
|
InterstitialAdEventListener |
|
|
AppOpenAdEventListener |
|
|
RewardedAdEventListener |
|
|
BannerAd |
|
每个方法都包含一个 ImpressionData 参数,并带有一个 getRawData 方法。此方法返回一个包含 ILRD 的 JSON 字符串(请参阅下表)。
备注
onAdImpression / onImpression 方法仅在记录广告展示次数后触发。
void _setAdEventListener(RewardedAd ad) {
ad.setAdEventListener(
eventListener: RewardedAdEventListener(
// ... 其他方法
onAdImpression: (ImpressionData impressionData) {
final rawData = impressionData.getRawData();
debugPrint('[ILRD] Raw: $rawData');
try {
final json = jsonDecode(rawData) as Map<String, dynamic>;
debugPrint('[ILRD] ad_unit_id: ${json['ad_unit_id']}');
debugPrint('[ILRD] adType: ${json['adType']}');
debugPrint('[ILRD] currency: ${json['currency']}');
debugPrint('[ILRD] revenue: ${json['revenue']}');
debugPrint('[ILRD] revenueUSD: ${json['revenueUSD']}');
debugPrint('[ILRD] precision: ${json['precision']}');
final network = json['network'] as Map<String, dynamic>?;
if (network != null) {
debugPrint('[ILRD] network.name: ${network['name']}');
debugPrint('[ILRD] network.ad_unit_id: ${network['ad_unit_id']}');
}
} catch (e) {
debugPrint('[ILRD] Parse error: $e');
}
},
),
);
}
可用数据
您可以解析 rawData 以获取下列信息:
|
键值 |
类型 |
描述 |
|
|
字符串 |
唯一的 |
|
|
字符串 |
广告类别:
|
|
|
字符串 |
广告网络使用的货币。 |
|
|
字符串 |
以广告网络货币计算的展示收入。使用 |
|
|
字符串 |
单次展示的收入,以美元为单位。 |
|
|
字符串 |
|
|
|
字符串 |
提供本次展示机会的广告网络的名称。 |
|
|
字符串 |
投放广告的网络中的唯一 ad unit ID。 |