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 com.cleveradssolutions.sdk.AdContentInfo data structure, which contains information about the loaded/displayed ad.

Additionally to OnAdImpressionListener, each ad format has a getContentInfo()/contentInfo accessor that returns AdContentInfo, but the info may be null before the ad is loaded.

val info = eachAd.contentInfo
formatAdFormat

The format of the ad that is shown.

sourceNameString

The display name of the mediated network that purchased the impression.

sourceIdInt

The ID of the mediated network that purchased the impression. See AdSource constants.

sourceUnitIdString

The Ad Unit ID from the mediated network that purchased the impression.

creativeIdString?optional

The Creative ID associated with the ad, if available. You can use this ID to report creative issues to the Ad review team.

revenueDouble

The revenue generated from the impression, in USD. The revenue value may be either estimated or exact, depending on the precision specified by revenuePrecision.

revenuePrecisionInt

The precision type of the revenue field. See AdRevenuePrecision constants.

revenueTotalDouble

The accumulated value of user ad revenue in USD from all ad format impressions.

impressionDepthInt

The total number of impressions across all ad formats for the current user, across all sessions.

User ad summary

CAS count the number of ad impressions and the total revenue of all formats at the time of a new impression.

val totalImpressions: Int = impression.impressionDepth
val totalRevenue: Double = impression.revenueTotal

Progress is saved between sessions until the user clears your app's data.

OnAdImpressionListener

A functional interface for listening to ad impression events.

import com.cleveradssolutions.sdk.OnAdImpressionListener

val impressionListener = OnAdImpressionListener { ad ->
    // Called when an ad impression occurs.
}

Each ad format provides a setter on the ad object for registering a listener to receive AdContentInfo with impression details.

val appOpenAd: CASAppOpen 
appOpenAd.onImpressionListener = impressionListener

val interstitialAd: CASInterstitial 
interstitialAd.onImpressionListener = impressionListener

val rewardedAd: CASRewarded 
rewardedAd.onImpressionListener = impressionListener

val nativeAd: NativeAdContent
nativeAd.onImpressionListener = impressionListener

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

If you haven't already, make sure to complete the following tasks:

  1. Set up your project and app as described in Get Started with Analytics.
  2. Make sure that you've linked your Firebase project to a Google Analytics account.
  3. 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.

Tenjin

To measure ad revenue with Tenjin Analytics integrate the Tenjin SDK or just include Tenjin SDK by CAS Cocoapods:

cas {
    includeTenjinSDK = true
}

CAS SDK automatically initializes the Tenjin SDK and sends ILRD if this option is enabled for your application.

Custom collect ad revenue

The following code shows an implementation example for logging AD_IMPRESSION event to Google Analytics.

override fun onAdImpression(ad: AdContentInfo) {
    val params = Bundle().apply {
        putString(FirebaseAnalytics.Param.AD_PLATFORM, "CAS")
        putString(FirebaseAnalytics.Param.AD_FORMAT, ad.format.toString())
        putString(FirebaseAnalytics.Param.AD_SOURCE, ad.sourceName)
        putString(FirebaseAnalytics.Param.AD_UNIT_NAME, ad.sourceUnitId)
        putDouble(FirebaseAnalytics.Param.VALUE, ad.revenue)
        // All CAS revenue is sent in USD
        putString(FirebaseAnalytics.Param.CURRENCY, "USD")
    }
    FirebaseAnalytics.getInstance(this)
        .logEvent(FirebaseAnalytics.Event.AD_IMPRESSION, params)
}