-
Notifications
You must be signed in to change notification settings - Fork 4
Impression Level Data
⚡ Before you start
Make sure you have correctly Initialize CAS.
CleverAdsSolutions 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.
AdMetaData
is an class for getting detailed information about the current ad impression, such as revenue and ad creative details.
Each ad format has a callback to receive an AdImpression
about the current impression.
The code below demonstrates how to handle impression events for Interstitial ad and Banner ad:
void OnEnable()
{
if (manager == null) return;
manager.GetAdView(AdSize.Banner).OnImpression += HandleAdViewImpression;
manager.OnInterstitialAdImpression += HandleInterstitialAdImpression;
manager.OnRewardedAdImpression += HandleRewardedAdImpression;
manager.OnAppReturnAdImpression += HandleAppReturnAdImpression;
}
void OnDisable()
{
if (manager == null) return;
manager.GetAdView(AdSize.Banner).OnImpression -= HandleAdViewImpression;
manager.OnInterstitialAdImpression -= HandleInterstitialAdImpression;
manager.OnRewardedAdImpression -= HandleRewardedAdImpression;
manager.OnAppReturnAdImpression -= HandleAppReturnAdImpression;
}
private void HandleAdViewImpression(IAdView view, AdMetaData impression)
{
// Get ad details of Banner Ad using impression parameter
}
private void HandleInterstitialAdImpression(AdMetaData impression)
{
// Get ad details of Interstitial Ad using impression parameter
}
private void HandleRewardedAdImpression(AdMetaData impression)
{
// Get ad details of Rewarded Ad using impression parameter
}
private void HandleAppReturnAdImpression(AdMetaData impression)
{
// Get ad details of AppReturn Ad using impression parameter
}
The revenue generated for the impression (USD). The revenue value is either estimated or exact, according to the priceAccuracy
property.
double revenue = impression.revenue;
You can also check the precision estimate for the revenue
value, as shown in the following example:
PriceAccuracy precision = impression.priceAccuracy;
if (precision == PriceAccuracy.Floor)
{
// The estimated revenue, can also be a minimum price (floor) for ad impression.
}
else if (precision == PriceAccuracy.Bid)
{
// The revenue provided as part of the real-time auction.
}
else
{
// The revenue is '0', when the demand source does not agree to disclose the payout of impression.
}
You can also retrieve information about the current ad (such as its mediated network and creative ID), and you will be able to report creative issues for that ad to our Ad review team.
AdType placementType = impression.type;
string creativeId = impression.creativeIdentifier;
AdNetwork network = impression.network;
string networkUnitId = impression.identifier;
string networkSDKVersion = impression.versionInfo;
Warning
impression.creativeIdentifier
may return null.
A list of all supported networks can be found in AdNetwork
class. For example:
if (networkName == AdNetwork.GoogleAds)
{
// Impression from Google Ads network.
}
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.lifetimeRevenue;
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.
- Ensure that you've included in your app the CAS SDK 3.7.2+.
The following code shows an implementation example for log AD_IMPRESSION
event to Google Analytics.
void CollectImpression(AdMetaData impression)
{
if (impression.priceAccuracy == PriceAccuracy.Undisclosed)
{
return;
}
Firebase.Analytics.Parameter[] AdParameters = {
new Firebase.Analytics.Parameter("ad_platform", "CAS"),
new Firebase.Analytics.Parameter("ad_source", impression.network.ToString()),
new Firebase.Analytics.Parameter("ad_unit_name", impression.identifier),
new Firebase.Analytics.Parameter("ad_format", impression.type.ToString()),
new Firebase.Analytics.Parameter("currency", "USD"), // All CAS revenue is sent in USD
new Firebase.Analytics.Parameter("value", impression.revenue)
};
Firebase.Analytics.FirebaseAnalytics.LogEvent("ad_impression", AdParameters);
}
- Project Setup
- Configuring SDK
- Include Android
- Include iOS
- Additional mediation steps
- App-ads.txt🔗