Documentation

LevelPlay SDK - Flutter

Impression-level revenue integration for Flutter

Integrate the Impression Level Revenue (ILR) SDK API to capture real-time ad revenue data for each impression, enabling detailed monetization insights and seamless integration with third-party analytics platforms.
Read time 2 minutesLast updated 3 days ago

Prerequisites

Ensure that you have correctly integrated the LevelPlay Flutter plug-in 9.3.0+ into your application.

Implement the impression data listener

The LevelPlay SDK fires postbacks to inform you about the displayed ad.
LevelPlayImpressionDataListener
is an optional listener that you can implement to receive impression data, so you can identify each ad using its impression-level revenue.
Starting with plug-in version 9.3.0, you set an impression data listener on each ad object. The listener receives the impression data of that ad only.
class MyImpressionDataListener implements LevelPlayImpressionDataListener { @override void onImpressionSuccess(LevelPlayImpressionData impressionData) { // Use the impression data }}

Interstitial and rewarded ads

Call
setImpressionDataListener
on the ad object before you show the ad:
final interstitialAd = LevelPlayInterstitialAd(adUnitId: 'YOUR_INTERSTITIAL_AD_UNIT_ID');interstitialAd.setImpressionDataListener(MyImpressionDataListener());final rewardedAd = LevelPlayRewardedAd(adUnitId: 'YOUR_REWARDED_AD_UNIT_ID');rewardedAd.setImpressionDataListener(MyImpressionDataListener());
Pass the listener with the
impressionDataListener
parameter of
LevelPlayBannerAdView
:
LevelPlayBannerAdView( adUnitId: 'YOUR_BANNER_AD_UNIT_ID', adSize: LevelPlayAdSize.BANNER, listener: myBannerListener, impressionDataListener: MyImpressionDataListener(),);
Note
LevelPlay.addImpressionDataListener
is deprecated starting with plug-in version 9.3.0, following the native SDKs. It still receives the impression data of all ads, but use the per-ad listeners for new integrations. If you use it, add the listener before you initialize the LevelPlay SDK, to avoid losing impression data.

Integrate the ILR data

After you implement
LevelPlayImpressionDataListener
, you can use the impression data and send it to your own proprietary BI tools and DWH, or integrate it with third-party tools.
Note
The returned data might include null values. Make sure to add protections before assigning the data, to avoid potential crashes.
You can refer to each field of the
LevelPlayImpressionData
object:
@overridevoid onImpressionSuccess(LevelPlayImpressionData impressionData) { String? auctionId = impressionData.auctionId; String? mediationAdUnitName = impressionData.mediationAdUnitName; String? mediationAdUnitId = impressionData.mediationAdUnitId; String? adFormat = impressionData.adFormat; String? country = impressionData.country; String? ab = impressionData.ab; String? segmentName = impressionData.segmentName; String? placement = impressionData.placement; String? adNetwork = impressionData.adNetwork; String? instanceName = impressionData.instanceName; String? instanceId = impressionData.instanceId; double? revenue = impressionData.revenue; String? precision = impressionData.precision; String? encryptedCPM = impressionData.encryptedCPM; double? conversionValue = impressionData.conversionValue; // iOS only String? creativeId = impressionData.creativeId;}
For the full list of fields and types, refer to the Impression Level Revenue SDK API documentation.