Skip to content

Configuring SDK

Denis edited this page Mar 16, 2021 · 49 revisions

⚡ Before you start
Make sure you have correctly setup project settings.

Settings to initialize mediation managers

General Ads settings

Runtime Ads settings


In your Unity project, navigate to Assets > CleverAdsSolutions > Settings to create and modify default settings for each native platform.
Also you can change some settings at runtime using CAS.MobileAds.settings singleton.

Settings to initialize mediation managers

Test Ad Mode

The quickest way to testing is to enable Test Ad Mode. These ad are not associated with your account, so there's no risk of your account generating invalid traffic when using these ad units.

Manager Ids

An manager ID is a unique ID number assigned to each of your ad placements when they're created in CAS.
The manager ID is added to your app's code and used to identify ad requests.
If you haven't created an CAS account and registered an app yet, now's a great time to do so at cleveradssolutions.com.
In a real app, it is important that you use your actual CAS manager ID.

⭐ To work properly, you must define all identifiers that will be used in the application for a specific platform.

If you're just looking to experiment with the SDK, though, you can use the Test Ad Mode above with any manager ID.

Allowed ads types in app

To improve the performance of your application, we recommend that you only allow ad types that will actually be used in the application.
For example: AdFlags.Banner | AdFlags.Interstitial ad.

The processes of ad types can be disabled/enabled at any time using following method:

CAS.MobileAds.manager.SetEnableAd(adType, enabled);

Audience Tagged

Choose the audience your game is targeting.
The changing audience will change the availability of the mediation network dependency. Please follow the instructions provided in the settings window.

General Ads settings

Banner Size

Select the banner size to initialize.

Size in dp (WxH) Description Availability CASSize constant
320x50 Standard Banner Phones and Tablets Banner
728x90 IAB Leaderboard Tablets Leaderboard
300x250 IAB Medium Rectangle Phones and Tablets MediumRectangle
Adaptive Adaptive banner Phones and Tablets AdaptiveBanner
320x50 or 728x90 Smart Banner Phones and Tablets SmartBanner
  • Adaptive banners are the next generation of responsive ads, maximizing performance by optimizing ad size for each device.
    To pick the best ad size, adaptive banners use fixed aspect ratios instead of fixed heights. This results in banner ads that occupy a more consistent portion of the screen across devices and provide opportunities for improved performance. You can read more in this article.

  • Smart Banners selects one of the sizes depending on the device: on phones have a Banner size or on tablets a Leaderboard size.

We do not recommend resizing your banner frequently while playing as this will result in the loss of expensive ad impressions.

Change the banner size using the following method:

CAS.MobileAds.manager.bannerSize = bannerSize;

Banner Refresh rate

An ad unit’s automatic refresh rate (in seconds) determines how often a new ad request is generated for that ad unit.

Ad requests should not be made when the device screen is turned off.
We recomended using refresh rate 30 seconds. However, you can choose any value you want longer than 10 seconds.

Change the banner automatic refresh rate using the following method:

CAS.MobileAds.settings.bannerRefreshInterval = refreshInterval;

Interstitial impression interval

You can limit the posting of an interstitial ad to a period of time in seconds after the ad is closed, during which display attempts will fail.

During interval after ad closed display attempts will fire event OnInterstitialAdFailedToShow.

Change the interstitial ad impression interval using the following method:

CAS.MobileAds.settings.interstitialInterval = interval;

That the interval starts only after the Interstitial Ad closes OnInterstitialAdClosed.
If you need to wait for a period of time after the start of the game or after showing a Rewarded Ad until next Interstitial Ad impression then please call the following method:

CAS.MobileAds.settings.RestartInterstitialInterval();

Allow Interstitial Ad when the cost of the Rewarded Ad is lower

The option will compare ad cost and serve regular interstitial ads when rewarded video ads are expected to generate less revenue.
Interstitial Ads does not require to watch the video to the end, but the OnRewardedAdCompleted callback will be triggered in any case.

Change the flag at any time using the following method:

CAS.MobileAds.settings.allowInterstitialAdsWhenVideoCostAreLower = allow;

Loading mode

Select the Waterfall loading mode.

Mode Load*1 Impact on App performance Memory usage Actual ads*2
FastestRequests Auto Very high High Most relevant
FastRequests Auto High Balance High relevance
Optimal (Default) Auto Balance Balance Balance
HighPerformance Auto Low Low Possible loss
HighestPerformance Auto Very low Low Possible loss
Manual Manual*3 Very low Low Depends on the frequency

^1: Auto control load mediation ads starts immediately after initialization and will prepare displays automatically.

^2: Potential increase in revenue by increasing the frequency of ad requests. At the same time, it greatly affects the performance of the application.

^3: Manual control loading mediation ads requires manual preparation of advertising content for display. Use ad loading methods before trying to show: CAS.MobileAds.manager.LoadAd().

Change the Waterfall loading mode using the following method:

CAS.MobileAds.settings.loadingMode = mode;

Debug log mode

The enabled Debug Mode will display a lot of useful information for debugging about the states of the sdk with tag CAS.
Disabling the Debug Mode may improve application performance.
Change the Debug Mode flag at any time using the following method:

CAS.MobileAds.settings.isDebugMode = enabled;

Analytics collection

If your application uses Google Analytics (Firebase) then Clever Ads Solutions collects ad impressions and states to analytic.
Disabling analytics collection may save internet traffic and improve application performance.

The Analytics collection has no effect on ad revenue.

Change the analytics collection flag at any time using the following method:

CAS.MobileAds.settings.analyticsCollectionEnabled = enabled;

Runtime Ads settings

Targeting Options

You can now easily tailor the way you serve your ads to fit a specific audience!
You’ll need to inform our servers of the users’ details so the SDK will know to serve ads according to the segment the user belongs to.

Set user gender using the following method:

CAS.MobileAds.targetingOptions.gender = CAS.Gender.Male;

Set user age with limitation 1-99 and 0 is 'unknown' using the following method:

CAS.MobileAds.targetingOptions.age = 12;

Test Device Ids

Identifiers corresponding to test devices which will always request test ads. The test device identifier for the current device is logged to the console when the first ad request is made.

CAS.MobileAds.settings.SetTestDeviceIds(testDeviceIds);

Execute events on Unity Thread

Callbacks from CleverAdsSolutions are not guaranteed to be called on Unity thread. You can use EventExecutor to schedule each calls on the next Update() loop:

CAS.EventExecutor.Add(callback);

OR enable isExecuteEventsOnUnityThread property to automatically schedule all calls on the next Update() loop.

CAS.MobileAds.settings.isExecuteEventsOnUnityThread = enable;

Disabled by default.

Muted Ads Sounds

Sounds in ads mute state.
Disabled by default.

CAS.MobileAds.settings.isMutedAdSounds = mute;

What’s Next?

Clone this wiki locally