Skip to content

Commit ecacb3f

Browse files
authored
[HB-5971] Update loading-ads.md to Include More Details On Adaptive Banners (#188)
* Update loading-ads.md Signed-off-by: kushG <kushagrag@sturfee.com> * fixed links Signed-off-by: kushG <kushagrag@sturfee.com> * Update loading-ads.md Signed-off-by: kushG <kushagrag@sturfee.com> * Update loading-ads.md Signed-off-by: kushG <kushagrag@sturfee.com> --------- Signed-off-by: kushG <kushagrag@sturfee.com>
1 parent c485d78 commit ecacb3f

File tree

1 file changed

+73
-4
lines changed

1 file changed

+73
-4
lines changed

com.chartboost.mediation/Documentation/integration/loading-ads.md

Lines changed: 73 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,47 @@ Debug.Log($"Fullscreen Placement Loaded with PlacementName: {placementName}")
5757
> **Warning** \
5858
> The new fullscreen API utilizes instance based callbacks to notify information regarding the advertisement life-cycle. You must take this into account when migrating from the old API static callbacks.
5959
60-
## Creating Banner Ad Objects
60+
## Banner Ad Objects
61+
62+
Mediation SDK 4.6.0 introduces a new [Adaptive Banner](https://docs.chartboost.com/en/mediation/ad-types/#adaptive-banner/) ad format, capable of serving flexible and fixed sized ads in the placement. The new [Adaptive Banner]([/en/mediation/ad-types/#adaptive-banner/](https://docs.chartboost.com/en/mediation/ad-types/#adaptive-banner/)) ad format has the following features:
63+
- Publishers can choose whether to use Adaptive Ads or Fixed Ads in a given placement.
64+
- Fixed Ads are supported in Adaptive Ad placements (backwards compatible).
65+
- Publishers should know whether an ad is fixed or flexible and receive the dimensions of fixed ads.
66+
- Publishers can align the ad horizontally and/or vertically.
67+
- Publishers can resize the ad container to fit the ad or optionally discard oversized ads that are rendered in the container.
68+
- The ad container can be in-line or on top of publisher content.
69+
70+
To use this new ad format, Publishers will need to create a new Adaptive Banner placement in their platform and integrate with the new Adaptive Banner APIs.
71+
72+
> **Caution** \
73+
> Google Bidding does not support 0 height adaptive banner sizes and will result in no fill.
74+
75+
76+
We have added a new Banner API `ChartboostMedaitionBannerView` to allow usage of adaptive banners. The previous `ChartboostMedaitionBannerAd` API has now been deprecated.
6177

62-
Since Chartboost Mediation Unity SDK 4.6.X we have deprecated the previous approach for loading banner placements. A new Banner API `ChartboostMedaitionBannerView` has been provided which makes use of C# asycn/await methods in order to await for load and show and also provides support to load adaptive size banners.
6378

6479
Another API `ChartboostMediationUnityBannerAd` is also provided which allows usage of unity gameobjects to load a banner ad within it.
6580

81+
The API class `ChartboostMediationBannerSize` will support both fixed and adaptive banners:
82+
83+
|Field|Description|
84+
|--|--|
85+
|`static ChartboostMediationBannerSize Standard`|Static constant that returns a fixed `STANDARD` banner with a size of 320x50.|
86+
|`static ChartboostMediationBannerSize MediumRect`|Static constant that returns a fixed MREC `MEDIUM` banner with a size of 300x250.|
87+
|`static ChartboostMediationBannerSize Leaderboard`|Static constant that returns a fixed `LEADERBOARD` banner with a size of 728x90.|
88+
|`ChartboostMediationBannerType BannerType`|An enum specifying that the ad size is fixed (size cannot change), or adaptive (size can change but must maintain aspectRatio). This is an integer based enum.|
89+
|`float Width`|The width of the ad.|
90+
|`float Height`|The height of the ad.|
91+
|`float AspectRatio`|The aspect ratio of the ad. This can be derived from the size. Will be 0 if either the width or the height are <= 0.|
92+
|`static ChartboostMediationBannerSize Adaptive(float width)`|Creates a flexible/adaptive banner size with 0 height.|
93+
|`static ChartboostMediationBannerSize Adaptive(float width, float height)`|Creates a flexible/adaptive banner size with a width and max height. Used either when the height of an inline ad should be capped, or when requesting an anchored banner.|
94+
|`<additional conveniences>`|This provides additional conveniences to create sizes based on the IAB ratios (e.g. 6:1, 1:1) with a width. For example, using the 6:1 convenience with a 600 width would return a size of 600x100. Note that these are max sizes, therefore smaller sizes or other aspect ratios may be served.|
95+
96+
97+
### Loading Banner ads
6698
A detailed example on the load logic for both of these APIs can be found below :
6799

68-
### Using `ChartboostMediationBannerView` API
100+
#### Using `ChartboostMediationBannerView` API
69101

70102
```c#
71103
// Get a bannerView
@@ -111,7 +143,7 @@ float y = ChartboostMediationConverters.PixelsToNative(200);
111143
await bannerView.Load(loadRequest, x, y);
112144
```
113145

114-
### Using `ChartboostMediationUnityBannerAd` API
146+
#### Using `ChartboostMediationUnityBannerAd` API
115147

116148
`ChartboostMediationUnityBannerAd` API enables loading of a bannerAd within a unity gameobject.
117149
To create this gameobject, right-click in the hierarchy window and select `Chartboost Mediation/UnityBannerAd`
@@ -148,6 +180,43 @@ if(!loadResult.Error.HasValue)
148180

149181
You can implement delegates in your class to receive notifications about the success or failure of the ad loading process for Banner formats. See section [Delegate Usage](delegate-usage.md) for more details.
150182

183+
### Resizing Adaptive Banner Container
184+
185+
#### Using `ChartboostMediationBannerView` API
186+
187+
```C#
188+
bannerView.DidLoad += (banner) =>
189+
{
190+
// Determine the axis on which you want the bannerView to resize
191+
var resizeAxis = ChartboostMediationBannerResizeAxis.Vertical;
192+
193+
// Make the resize call
194+
bannerView.ResizeToFit(resizeAxis);
195+
}
196+
197+
```
198+
199+
#### Using `ChartboostMediationUnityBannerAd` API
200+
```C#
201+
// Determine the resizeOption you want to set on this gameobject
202+
ResizeOption resizeOption = ResizeOption.FitVertical;
203+
204+
// Update the resizeOption
205+
unityBannerAd.ResizeOption = resizeOption
206+
207+
```
208+
209+
### Discarding Oversized Ads
210+
211+
```C#
212+
// To drop oversized ads
213+
ChartboostMediation.DiscardOversizedAds(true)
214+
215+
// To allow oversized ads
216+
ChartboostMediation.DiscardOversizedAds(false)
217+
218+
```
219+
151220
## Clearing Loaded Ads
152221

153222
Sometimes, you may need to clear loaded ads on existing placements to request another ad (i.e. for an in-house programmatic auction). To do this:

0 commit comments

Comments
 (0)