Skip to content

Configuring SDK

Denis edited this page Jan 14, 2022 · 49 revisions

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


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.

Manager Ids

A 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.

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.
Read more about Test ad mode.

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.
image

Loading mode

Managing ad availability is not easy. Keeping a balance between maximum ad availability while minimizing waste (network calls - which may affect user experience and data usage - and calls to mediated networks APIs - which may negatively impact eCPM if their inventory never gets to be shown to a user) can turn out to be harder than expected. In fact, often, it is simply guess work as you cannot predict ahead of time when a user will reach a moment in your application or game where it makes sense to show an Interstitial or offer the possibility to watch a Rewarded ad.

When you try to time your ad requests, this often results in not having a fill when you need it or having wasted fills that are never shown.
The CAS SDK provides an “auto-request” feature to address this problem.
By default, CAS SDK starts with auto-request enabled for all managers.

This means two things:

  • When a user finishes watching an ad, CAS immediately tries to replace that ad.
  • When a certain placement has trouble obtaining a fill (no traditional mediated network has available inventory and no programmatic demand is bidding within a predetermined amount of time), CAS continues trying to ensure that placement gets a fill by restarting the entire ad request process. This is performed in exponentially increasing time intervals to optimize the chances of getting a fill while minimizing usage of device resources.

However, you can choose to disable auto-request when you set Manual 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;

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.Initialize();
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.

Impression 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;

Delay measurement of the Google SDK initialization

By default, the Google Mobile Ads SDK initializes app measurement and begins sending user-level event data to Google immediately when the app starts. This initialization behavior ensures you can enable AdMob user metrics without making additional code changes.

However, if your app requires user consent before these events can be sent or you want increase start app performance, you can delay app measurement until CAS explicitly initialize the Mobile Ads SDK.

To delay app measurement, just check option and CAS Unity plugin add the <meta-data> tag with com.google.android.gms.ads.DELAY_APP_MEASUREMENT_INIT" to AndroidManifest.xml.

Auto check for CAS updates

CAS check for new versions of the unity plugin when opening the settings window. If a new version is found then you will be prompted to update the plugin.
You can disable the auto check update and use the Check for Updated button at the top of the settings window.

Most popular country of users

CAS uses a mediation configuration caching system to handle unexpected situations.
You can select the country for which the configuration cache will be prepared in build resources.
The country must be specified by ISO 3166-1 alpha-2 codes.


What’s Next?