-
Notifications
You must be signed in to change notification settings - Fork 4
Impression Level Data
CAS.AI SDK enables you to access detailed information for each impression through the impressions callback APIs. The information includes, for example, which demand source served the ad, the expected or exact revenue associated with it. In addition, it contains granular details to allow you to analyze and, ultimately, optimize user acquisition strategies.
A functional interface for listening to ad impression events.
final OnAdImpressionListener _impressionListener = OnAdImpressionListener(
onAdImpression: (ad) {
// Called when an ad impression occurs.
},
);
Each ad format provides a setOnImpressionListener
method on the ad object for registering a listener to receive AdContentInfo
with impression details.
CASAppOpen appOpenAd;
appOpenAd.impressionListener = _impressionListener;
CASInterstitial interstitialAd;
interstitialAd.impressionListener = _impressionListener;
CASRewarded rewardedAd;
rewardedAd.impressionListener = _impressionListener;
NativeAdContent nativeAd;
nativeAd.impressionListener = _impressionListener;
The AdContentInfo
data structure, which contains information about the loaded/displayed ad.
Before the impression occurs, AdContentInfo
can be received via OnAdImpressionListener
, ScreenAdContentCallback
.
Additionally, each ad format has a getContentInfo()
method that returns AdContentInfo
, but the info may be null
before the ad is loaded.
AdContentInfo info = eachAd.getContentInfo();
Name | Type | Description |
---|---|---|
format |
AdFormat |
Gets the format of the ad that is shown. See new AdFormat enum. |
sourceName |
String |
Gets the display name of the mediated network that purchased the impression. |
sourceId |
Int |
Gets the ID of the mediated network that purchased the impression. See new AdSourceId constants. |
sourceUnitId |
String |
Gets the Ad Unit ID from the mediated network that purchased the impression. |
creativeId |
String? |
Gets the Creative ID associated with the ad, if available. May be null. You can use this ID to report creative issues to the Ad review team. |
revenue |
Double |
Gets the revenue generated from the impression, in USD. The revenue value may be either estimated or exact, depending on the precision specified by revenuePrecision . |
revenuePrecision |
Int |
Gets the precision type of the revenue field. See new AdRevenuePrecision constants. |
impressionDepth |
Int |
Gets the total number of impressions across all ad formats for the current user, across all sessions. |
revenueTotal |
Double |
Gets the accumulated value of user ad revenue in USD from all ad format impressions. |
CAS count the number of ad impressions and the total revenue of all formats at the time of a new impression.
int totalImpressions = await impression.getImpressionDepth();
double totalRevenue = await impression.getRevenueTotal();
Note
Progress is saved between sessions until the user clears your app's data.
The CAS SDK have features to automatically collect ad revenue to Google Analytics and Tenjin Analytics. Contact your account manager for details of enabling automatic events.
If you haven't already, make sure to complete the following tasks:
- Set up your project and app as described in Get Started with Analytics.
- Make sure that you've linked your Firebase project to a Google Analytics account.
- Ensure that you've included in your app the CAS SDK 3.5.0+.
To measure ad revenue, CAS SDK log ad_impression
events whenever your user sees an advertisement in your app. These events contain details such as the ad platform, source, currency, and value. Optionally, the alternative event name can be CAS_Impression
.
If you haven't already, make sure to complete the following tasks:
- Set up your project and app as described in Get Started with Analytics.
- Make sure that you've initialize tenjin session. Or provide
TENJIN_SDK_KEY
with CAS SDK initialization to allow CAS initialize Tenjin SDK automatically.builder.withMediationExtras("tenjin_key", TENJIN_SDK_KEY)
- Ensure that you've included in your app the CAS SDK 3.7.2+.
The following code shows an implementation example for log adImpression
event to Google Analytics.
final OnAdImpressionListener _impressionListener = OnAdImpressionListener(
onAdImpression: (ad) async {
final params = <String, dynamic>{
FirebaseAnalytics.Param.adPlatform: "CAS",
FirebaseAnalytics.Param.adFormat: ad.format.toString(),
FirebaseAnalytics.Param.adSource: ad.sourceName,
FirebaseAnalytics.Param.adUnitName: ad.sourceUnitId,
FirebaseAnalytics.Param.value: ad.revenue,
// All CAS revenue is sent in USD
FirebaseAnalytics.Param.currency: "USD",
};
await FirebaseAnalytics.instance.logEvent(
name: FirebaseAnalyticsEvent.adImpression,
parameters: params,
);
},
);
Android SDK | iOS SDK | Unity SDK | Flutter SDK | App-ads.txt | cleveradssolutions.com | [email protected]