---
title: 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 a 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.
```dart
AdContentInfo? info = await eachAd.getContentInfo();
```

<Property name="format" type="AdFormat">
  The format of the ad that is shown.
</Property>

---

<Property name="sourceName" type="String">
  The display name of the mediated network that purchased the impression.
</Property>

---

<Property name="sourceUnitId" type="String">
  The Ad Unit ID from the mediated network that purchased the impression.
</Property>

---

<Property name="creativeId" type="String?" optional>
  The Creative ID associated with the ad, if available.
  You can use this ID to report creative issues to the Ad review team. 
</Property>

---

<Property name="revenue" type="Double">
  The revenue generated from the impression, in USD. 
  The revenue value may be either estimated or exact, depending on the precision specified by `revenuePrecision`. 
</Property>

---

<Property name="revenuePrecision" type="Int">
  The precision type of the revenue field. See new `AdRevenuePrecision` constants.
</Property>

---

<Property name="revenueTotal" type="Double">
  The accumulated value of user ad revenue in USD from all ad format impressions. 
</Property>

---

<Property name="impressionDepth" type="Int">
  The total number of impressions across all ad formats for the current user, across all sessions. 
</Property>

### Ad Impression callback
A `onAdImpression` callback for ad impression with impression details in `AdContentInfo` for each ad formats:
```dart
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.
```dart
int totalImpressions = impression.impressionDepth;
double totalRevenue = impression.revenueTotal;
```
<Info>
Progress is saved between sessions until the user clears your app's data.
</Info>

## 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:

1. Get started with [Firebase Analytics](https://firebase.google.com/docs/analytics/get-started).
2. Link your Firebase project to a Google Analytics account.

The SDK automatically logs [`ad_impression`](https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Event#public-static-final-string-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](https://pub.dev/packages/tenjin_plugin) or just include Tenjin SDK by CAS Gadle plugin and CAS Cocoapods:

<Tabs groupId="platform">
<TabItem label="Android" value="android">
```kotlin
cas {
    includeTenjinSDK = true
}
```
</TabItem>

<TabItem label="iOS" value="ios">
```ruby
pod 'CleverAdsSolutions-SDK/Tenjin', '{{ versions.ios }}'
```
</TabItem>
</Tabs>

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