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.
AdContentInfo
The AdContentInfo data structure, which contains information about the loaded/displayed ad.
Additionally to onAdImpression callback, each ad format has a getContentInfo() method that returns AdContentInfo?, but the content info may be null before the ad is loaded.
AdContentInfo? info = await eachAd.getContentInfo();
| Name | Type | Description |
|---|---|---|
sourceName | String | Gets the display name of the mediated network that purchased the impression. |
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. |
revenueTotal | Double | Gets the accumulated value of user ad revenue in USD from all ad format impressions. |
impressionDepth | Int | Gets the total number of impressions across all ad formats for the current user, across all sessions. |
Ad Impression callback
A onAdImpression callback for ad impression with impression details in AdContentInfo for each ad formats:
CASAppOpen appOpenAd;
CASInterstitial interstitialAd;
CASRewarded rewardedAd;
CASBanner bannerAd;
NativeAdContent nativeAd;
void setAdImpressionCallback() {
appOpenAd.onAdImpression = _onAdImpression;
interstitialAd.onAdImpression = _onAdImpression;
rewardedAd.onAdImpression = _onAdImpression;
bannerAd.onAdImpression = _onAdImpression;
nativeAd.onAdImpression = _onAdImpression;
}
void _onAdImpression(AdInstance ad, AdContentInfo contentInfo) {
// Called when an ad impression occurs.
String adPlatform = "CAS";
String adFormat = ad.format.label;
String adSource = contentInfo.sourceName;
String adUnitName = contentInfo.sourceUnitId;
double value = contentInfo.revenue;
// All CAS revenue is sent in USD
String currency = "USD";
}
User ad summary
CAS count the number of ad impressions and the total revenue of all formats at the time of a new impression.
int totalImpressions = impression.impressionDepth;
double totalRevenue = impression.revenueTotal;
Progress is saved between sessions until the user clears your app's data.
Automatic collect ad revenue
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.
Google Analytics
To measure ad revenue with Google Analytics:
Get started with Firebase Analytics.
Link your Firebase project to a Google Analytics account.
The SDK automatically logs ad_impression
events whenever an ad is displayed.
Events include parameters such as ad platform, source, currency, and value.
Alternatively, CAS may log the event as CAS_Impression.
Tenjin
To measure ad revenue with Tenjin Analytics:
Integrate the Tenjin SDK.
Ensure a Tenjin session is initialized, or pass your key to CAS SDK so it initializes Tenjin automatically:
CASMobileAds.initialize( casId: casId, mediationExtras: { 'tenjin_key': TENJIN_SDK_KEY }, );