Banner
Banner ads are rectangular ad units that appear within the game UI and remain visible while the player interacts with the application. They are ideal for continuous, non-intrusive monetization and are commonly placed at the top or bottom of the screen.
The plugin supports multiple standard and adaptive banner sizes, as well as custom placement positions. You can load, show, hide, and destroy banner ads at any time during gameplay.
Banner ads are lightweight and refresh automatically according to the AdMob configuration, making them a stable and low-impact monetization option for most games.
Banner Types
When loading a banner ad, you can choose from six different types, each corresponding to a specific ad Size. Use the tabs below to preview each size and decide which one best fits your layout.
💡 The Leaderboard banner size is designed for tablets or large screens only.
Banner Ad Gravity
When displaying a banner ad, you can choose where on the screen the banner will be positioned. This defines the alignment and anchor point relative to the screen area. Each Gravity value corresponds to a specific corner or center position.
💡 The banner position can be changed dynamically without reloading the ad. If an ad is already displayed and you set a new Gravity, it will move to the new position.
Once a banner is loaded, it can be shown multiple times without reloading.
Load Banner
This function loads a banner ad of the selected size and prepares it for display. Before showing a banner, it must always be loaded first using this function.
It is recommended to call this function after AdMob initialization is complete — typically in the main menu or another non-interactive screen.
Parameters
1. Ad Unit ID
Specifies the unique identifier of your banner ad from your AdMob account.
2. Banner Ad Size
Defines which banner format to load. You can choose between multiple standard and adaptive sizes defined in EBannerAdSize. Common options include Banner (320×50), Full Banner (468x60), and Anchored Adaptive.
3. On Loaded
Called when the banner ad has been successfully loaded and is ready to display.
4. On Load Failed
Called if the banner fails to load. This callback returns an EAdErrorCode value describing the reason for failure — for example, NetworkError or NoFill.
5. On Event
Triggered when a banner event occurs, such as a click or impression. Returns a value of EBannerAdEventType indicating the event type — Opened, Clicked, Closed, or Impression.
Show Banner
This function displays a previously loaded banner ad on the screen. You must call Load Banner before using this function — banners cannot be shown until they are loaded successfully.
You can choose the banner’s position using the Banner Gravity parameter, which determines where on the screen the ad will appear (top, middle, or bottom). Additional offsets allow you to move the banner relative to that anchor.
Parameters
1. Banner Gravity
Specifies the screen position for the banner ad. Available values are defined in EBannerGravity. Typical options include Top Center, Middle Center, and Bottom Center (most commonly used).
2. Offset X
Horizontal shift in pixels.
- Positive value moves the banner to the right
- Negative — to the left
Applies consistently for all banner positions.
3. Offset Y
Vertical shift in pixels.
-
Positive value moves the banner up
-
Negative — down
Applies consistently for all banner positions.
4. On Success
Called when the banner is successfully displayed on screen.
5. On Failure
Called if the banner fails to appear (for example, if it hasn’t been loaded yet or was destroyed). This usually indicates that a new banner needs to be loaded before attempting to show it again. This callback returns an EAdErrorCode value describing the reason for failure.
Hide Banner
This function hides a currently visible banner ad from the screen without destroying it. The banner remains loaded in memory and can be shown again instantly using Show Banner.
This is useful when temporarily switching screens — for example, hiding the banner during gameplay or cutscenes, then showing it again in the main menu.
Destroy Banner
This function permanently removes the current banner ad from memory. After calling it, the banner must be loaded again before it can be shown. Use this function when changing scenes or exiting the part of the game where banners are no longer needed — for example, before starting a level.
Is Banner Ready
This function checks whether a banner ad has been successfully loaded and is ready to be shown. It is typically used to verify the ad’s state before calling Show Banner, preventing unnecessary errors or failures.
Return Value
Returns true if a banner ad is loaded and ready to display.
Returns false if the banner has not been loaded or failed to load.
Is Banner Visible
This function checks whether a banner ad is currently visible on the screen. It does not verify whether the banner is loaded — only whether it is actively being displayed after a successful call to Show Banner.
This is useful when your game needs to react to UI changes, avoid overlapping widgets, or hide gameplay elements when an ad is present.
Return Value
Returns true if the banner is currently visible on the screen.
Returns false if the banner is hidden, removed, or has never been shown.
Example
In this example, the Load Banner function is used to request a banner ad with the specified Ad Unit ID and size (Full Banner).
The example uses an official Google test Banner Unit ID ca-app-pub-3940256099942544/9214589741 to safely demonstrate functionality without serving real ads.
When the loading process completes successfully, the On Loaded event is triggered, which then checks whether the banner is ready to be shown using the Is Banner Ready function. If the banner is ready, the Show Banner node displays it at the Bottom Center of the screen.
This setup ensures that the banner appears only when it is fully prepared, preventing errors or empty placeholders. This approach is commonly used in menus or loading screens where ads can be preloaded and displayed seamlessly once ready.
C++ Usage
All banner-related Blueprint functions are also available for use in C++. You can manage banner loading, showing, hiding, and destruction directly through static methods of UAdMobCPPLibrary.
LoadBanner
#include "AdMobCPPLibrary.h"
void UMyClass::LoadBanner()
{
FOnBannerLoadedNative OnLoaded;
OnLoaded.BindLambda([]()
{
UE_LOG(LogTemp, Log, TEXT("Banner loaded successfully."));
});
FOnBannerLoadFailedNative OnLoadFailed;
OnLoadFailed.BindLambda([](EAdErrorCode Error, const FString& Message)
{
UE_LOG(LogTemp, Error, TEXT("Failed to load banner: %s (Code: %d)"), *Message, static_cast<int32>(Error));
});
FOnBannerEventNative OnEvent;
OnEvent.BindLambda([](EBannerAdEventType Event)
{
UE_LOG(LogTemp, Log, TEXT("Banner event: %d"), static_cast<int32>(Event));
});
UAdMobCPPLibrary::LoadBanner(TEXT("ca-app-pub-xxxxxxxxxxxxxxxx/xxxxxxxxxx"), EBannerAdSize::Banner, OnLoaded, OnLoadFailed, OnEvent);
}
ShowBanner
#include "AdMobCPPLibrary.h"
void UMyClass::ShowBanner()
{
FOnBannerShownNative OnSuccess;
OnSuccess.BindLambda([]()
{
UE_LOG(LogTemp, Log, TEXT("Banner displayed successfully."));
});
FOnBannerShowFailedNative OnFailure;
OnFailure.BindLambda([](EAdErrorCode Error, const FString& Message)
{
UE_LOG(LogTemp, Error, TEXT("Failed to show banner: %s (Code: %d)"), *Message, static_cast<int32>(Error));
});
// Show banner at Bottom Center with no offsets
const int32 OffsetX = 0;
const int32 OffsetY = 0;
UAdMobCPPLibrary::ShowBanner(EBannerGravity::BottomCenter, OffsetX, OffsetY, OnSuccess, OnFailure);
}
HideBanner
#include "AdMobCPPLibrary.h"
void UMyClass::HideBanner()
{
FOnBannerHiddenNative OnHidden;
OnHidden.BindLambda([]()
{
UE_LOG(LogTemp, Log, TEXT("Banner hidden successfully."));
});
UAdMobCPPLibrary::HideBanner(OnHidden);
}
DestroyBanner
#include "AdMobCPPLibrary.h"
void UMyClass::DestroyBanner()
{
FOnBannerDestroyedNative OnDestroyed;
OnDestroyed.BindLambda([]()
{
UE_LOG(LogTemp, Log, TEXT("Banner destroyed and memory released."));
});
UAdMobCPPLibrary::DestroyBanner(OnDestroyed);
}
IsBannerReady
#include "AdMobCPPLibrary.h"
void UMyClass::CheckBannerStatus()
{
bool bIsReady = UAdMobCPPLibrary::IsBannerReady();
UE_LOG(LogTemp, Log, TEXT("Is banner ready? %s"), bIsReady ? TEXT("Yes") : TEXT("No"));
}
IsBannerVisible
#include "AdMobCPPLibrary.h"
void UMyClass::CheckBannerVisibility()
{
const bool bVisible = UAdMobCPPLibrary::IsBannerVisible();
if (bVisible)
{
UE_LOG(LogTemp, Log, TEXT("Banner is currently visible on screen."));
}
else
{
UE_LOG(LogTemp, Log, TEXT("Banner is not visible."));
}
}