Impression Level Data
CAS.AI SDK enables you to access detailed information for each impression through the impression callback APIs.
The data includes which demand source served the ad and the exact or estimated revenue associated with it.
This allows you to analyze and optimize your monetization and user acquisition strategies.
AdContentInfo
The AdContentInfo structure contains information about a displayed ad.
In React Native, this object is provided to the AdImpressionEvent for each ad format.
formatstringThe format of the ad that is shown. (e.g. Banner, MREC, Interstitial, Rewarded, AppOpen).
sourceNamestringThe display name of the mediated network that purchased the impression.
sourceUnitIdstringThe Ad Unit ID from the mediated network that purchased the impression.
creativeIdstringoptionalThe Creative ID associated with the ad, if available. You can use this ID to report creative issues to the Ad review team.
revenuenumberThe revenue generated from the impression, in USD.
The revenue value may be either estimated or exact, depending on the precision specified by revenuePrecision.
revenuePrecisionstringThe precision type of the revenue field. (e.g. estimated, precise, floor).
revenueTotalnumberThe accumulated value of user ad revenue in USD from all ad format impressions.
impressionDepthnumberThe total number of impressions across all ad formats for the current user, across all sessions.
Ad Impression callback
Each ad format exposes an impression callback with AdContentInfo details:
import {
AppOpenAd,
InterstitialAd,
RewardedAd,
type AdContentInfo,
} from 'react-native-cas';
function setAdImpressionCallbacks() {
const unAppOpen = AppOpenAd.addAdImpressionEventListener(onAdImpression);
const unInterstitial = InterstitialAd.addAdImpressionEventListener(onAdImpression);
const unRewarded = RewardedAd.addAdImpressionEventListener(onAdImpression);
return () => {
unAppOpen();
unInterstitial();
unRewarded();
};
}
function onAdImpression(impression: AdContentInfo) {
// Called when an ad impression occurs.
const adPlatform = 'CAS';
const adFormat = impression.format;
const adSource = impression.sourceName;
const adUnitName = impression.sourceUnitId;
const value = impression.revenue;
// All CAS revenue is sent in USD
const currency = 'USD';
}
For banners, attach the handler directly to the React component:
<BannerAdView onAdViewImpression={(info) => onAdImpression(info)} />
User ad summary
CAS tracks cumulative impression and revenue metrics that are included in each AdContentInfo payload:
const totalImpressions = impression.impressionDepth;
const totalRevenue = impression.revenueTotal;
These counters persist between app sessions until the user clears your app’s data.
Automatic ad revenue collection
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, { mediationExtras: { tenjin_key: TENJIN_SDK_KEY }, });