Overview
Banner ads are rectangular ads displayed in a portion of the screen. They can be easily implemented using theAdropBanner component.
Key Features
- Can be fixed at the top, bottom, or middle of the screen
- Support for image and video ads
- Support for automatic or manual ad loading
- Ad event handling through callbacks
- Provides ad metadata (creative ID, campaign ID, etc.)
Use test unit IDs in development:
PUBLIC_TEST_UNIT_ID_320_100 or PUBLIC_TEST_UNIT_ID_320_50AdropBanner Component
Props
Unit ID created in the AdControl console
Banner style (width and height required)
Whether to automatically load ads when the component is mounted
Whether to use custom click handling. If set to
true, the browser won’t automatically open on ad click.Callback invoked when ad is successfully received
Callback invoked when user clicks the ad
Callback invoked when ad is displayed on screen
Callback invoked when ad reception fails
Basic Usage
Auto Load (Recommended)
Automatically load the ad when the component is mounted.Manual Load Using Ref
You can load ads at the desired time usingref.
Callback Functions
onAdReceived
Called when ad reception is successful.onAdClicked
Called when user clicks the ad.onAdImpression
Called when ad is displayed on screen.onAdFailedToReceive
Called when ad reception fails.AdropBannerMetadata
Type for ad metadata.Ad Sizes
Banner ads should have style dimensions that match the size set in the unit.Common Banner Sizes
| Size | Usage |
|---|---|
| 320 x 50 | Small banner |
| 320 x 100 | Medium banner |
| 16:9 ratio | Video banner |
Using Fixed Size
Fitting to Screen Width
Using Responsive Size
If
width is set as a string (e.g., '100%'), it works responsively, but if set as a number, that value is passed to the ad server to request ads of appropriate size.Test Unit IDs
Use the following test unit IDs during development and testing.| Ad Type | Test Unit ID | Size |
|---|---|---|
| Banner (320x50) | PUBLIC_TEST_UNIT_ID_320_50 | 320 x 50 |
| Banner (320x100) | PUBLIC_TEST_UNIT_ID_320_100 | 320 x 100 |
Usage Example
Error Handling
Implement appropriate error handling when ad loading fails.Managing Error State
Best Practices
1. Screen Visibility
Load ads when the banner is visible on screen.2. Loading Indicator
Improve user experience during ad loading.3. Managing Multiple Banners
Manage the state of each banner when using multiple banners.4. Custom Click Handling
UseuseCustomClick to handle ad clicks directly.