XMediator::Api::BannerAds
This class is the entry point for displaying banner ads. More...
Public Classes
Name | |
---|---|
class | Position Class representing the available positions where a banner can be placed. |
class | Size Class representing the available sizes that a banner can be created with. |
Public Events
Name | |
---|---|
Action< string, LoadResult > | OnLoaded() Notifies when a banner was loaded successfully, containing a LoadResult object. This callback can be called multiple times for each placement id, due to the banner autorefresh triggering more loads. |
Action< string, ImpressionData > | OnImpression() Notifies when a banner impression was recorded, containing an ImpressionData object. It can be called multiple times for each placement id due to banner autorefreshing. |
Action< string > | OnClicked() Notifies when a banner was clicked. |
Public Functions
Name | |
---|---|
void | Create(string placementId, Size size, Position position) Creates and loads a new banner. |
void | Load(string placementId) Manually refreshes a banner ad. |
void | SetPosition(string placementId, Position position) Sets the position of a banner. |
void | SetAdSpace(string placementId, string adSpace) Sets the ad space for the specified placementId. |
void | Show(string placementId, Position position) Shows a banner at the given position. It doesn't trigger a new load. |
void | Show(string placementId) Shows a banner at the last known position. It doesn't trigger a new load. |
void | Hide(string placementId) Hides a banner ad. |
Detailed Description
This class is the entry point for displaying banner ads.
To start, create a banner by providing a valid placement id in the Create method. Then call SetPosition and Show(string) or simply Show(string,XMediator.Api.BannerAds.Position) And that's it! You don't need to do anything else, as banners will refresh automatically while visible.
Note: You can only create one banner per placement id. Subsequent calls with the same placement id will be ignored.
Public Events Documentation
event OnLoaded
Notifies when a banner was loaded successfully, containing a LoadResult object. This callback can be called multiple times for each placement id, due to the banner autorefresh triggering more loads.
event OnImpression
Notifies when a banner impression was recorded, containing an ImpressionData object. It can be called multiple times for each placement id due to banner autorefreshing.
event OnClicked
Notifies when a banner was clicked.
Public Functions Documentation
function Create
Creates and loads a new banner.
Parameters:
- placementId A string containing a valid placement id.
- size Size of the banner. See Size for the available sizes.
- position Position on the screen where the banner will appear after it has been loaded. See Position.
function Load
Manually refreshes a banner ad.
Parameters:
- placementId The placement id of the ad to be refreshed.
The usage of this method is optional, as banner ads refresh automatically.
function SetPosition
Sets the position of a banner.
Parameters:
- placementId The placement id of the banner to change position.
- position The new position for the banner.
function SetAdSpace
Sets the ad space for the specified placementId.
Parameters:
- placementId The placement id of the banner ad.
- adSpace The space in your app from where the ad will be shown (eg: dashboard, settings). Set null to reset adSpace. Used for tracking.
function Show
Shows a banner at the given position. It doesn't trigger a new load.
Parameters:
- placementId The placement id of the ad to show.
- position The new position for the banner.
function Show
Shows a banner at the last known position. It doesn't trigger a new load.
Parameters:
- placementId The placement id of the ad to show.
function Hide
Hides a banner ad.
Parameters:
- placementId The placement id of the ad to hide.
Updated on 2024-11-07 at 18:31:49 +0000