Banner & MREC Ads
Banner and MREC ads are rectangular ad formats that occupy a portion of an app’s layout—often positioned at the top or bottom of the screen or placed inline within scrollable content. They remain visible as users interact with the app, allowing for uninterrupted gameplay or usage, and can be refreshed automatically after a set period.
The following sections show you how to load and then show and hide a banner or MREC ad.
Loading a Banner or MREC
To load a banner or MREC, call CreateBanner()
or CreateMRec()
, passing it your Ad Unit ID and desired ad view position:
Banners
const FString BannerAdUnitId = TEXT("«ad-unit-ID»");
void InitializeBannerAds(){ // Banners are automatically sized to 320×50 on phones and 728×90 on tablets // You may call the utility method UAppLovinMAX::IsTablet() to help with view sizing adjustments UAppLovinMAX::CreateBanner(BannerAdUnitId, EAdViewPosition::BottomCenter);
// Set background color for banners to be fully functional UAppLovinMAX::SetBannerBackgroundColor(BannerAdUnitId, «banner-background-color»);}
MRECs
const FString MRecAdUnitId = TEXT("«ad-unit-ID»");
void InitializeMRecAds(){ // MRECs are sized to 300x250 on phones and tablets // You may use the utility method 'UAppLovinMAX::IsTablet()' to help with view sizing adjustments UAppLovinMAX::CreateMRec(MRecAdUnitId, EAdViewPosition::Centered);}
The complete list of position options are:
TopLeft
TopCenter
TopRight
Centered
CenterLeft
CenterRight
BottomLeft
BottomCenter
BottomRight
Set your banner background color to any FColor
, for example FColor:Black
or FColor:FromHex("#fff200")
(yellow).
Showing a Banner or MREC
Show a banner or MREC with the following call:
UAppLovinMAX::ShowBanner(«ad-unit-ID»);
UAppLovinMAX::ShowMRec(«ad-unit-ID»);
Hiding a Banner or MREC
Hide a banner or MREC with the following call:
UAppLovinMAX::HideBanner(«ad-unit-ID»);
UAppLovinMAX::HideMRec(«ad-unit-ID»);