Skip to content

NativeAdHolder

GreedyBM edited this page Aug 22, 2024 · 41 revisions

Native Ad Holders communicate with the PubScaleManager to send ad requests and receive ad fills. It is the packaging unit of a single native ad placement in your scene and handles how and when to make Ad requests.

Native Ad Holder 1 2 8

Properties

Name Description
adTag This tag is used to identify an Ad placement in your game to track log events. Make sure they are unique.
canvas Reference to the parent canvas component.
placeholder This game object will be shown before the Ad loads and will get disabled once the ad is loaded.
adDisplay Reference to the default NativeAdDisplayHandler component which will determine how the native ad is shown once it is loaded.
MORE FORMATS (Optional) You can add more display variations. At runtime, the plugin selects the best variant based on the ad received.
landscapeAdFormats List of NativeAdDisplayHandlers tailored for Ads with a Landscape product image.
portraitAdFormats List of NativeAdDisplayHandler tailored for Ads with a Portrait product image.
nonMediaType List of NativeAdDisplayHandler which handles cases when the advertisement does not have a product image.
UseExtraFormats Boolean that tells the SDK to search the extra landscape and portrait formats at runtime when set to true. Otherwise, it will use only the default format assigned to adDisplay field.
AdLoaded Boolean that can used to check if an ad has just been loaded. It is reset to false when a new request to the ad cache is made.
AD FETCH OPTIONS
AutoFetch If enabled, the Ad will automatically be requested in OnEnable for the Game Object
TriggerFetchWithCollider If enabled, the Ad request will be made when a collider with a certain tag enters inside the bounds of the attached collider component. Make sure the IsTrigger is checked for the collider
TriggerOnCollisionWithTag The game object Tag that will trigger the Ad request if TriggerFetchWithCollider is enabled
If both the above are deselected, the Ad Holder expects you to invoke FetchAd() manually from another script
RefreshRate The Native Ad Holder makes a new ad request using this delay value after an impression is registered on the current ad displayed. The recommended value is 30s after an impression.

Public Methods

All these methods can be overloaded

Name Description
FetchAd Generates request for a new Ad.
DisableAd Switch between the Ad loading state and the Ad filled state. (⚠️ Native Ad can register to click events even if they are overlapped by other UI components make sure to call this function with a false argument to disable click detection).

The AdDisplayHandler is disabled and the placeholder object is activated.
HideAd Introduced in 1.4.1. This is a more convenient API built over DisableAd
UnHideAd Introduced in 1.4.1. This is a more convenient API built over DisableAd that automates some additional checks
StopRefresh Stops the Ad unit refresh calls.
ResetTriggerByColliderAdFetchCondition Resets the condition to trigger a FetchAd call when using Collider as trigger

Events

Name Description
Event_AdRequest Action Raised before the referenced NativeAdHolder component request for new Ad from the ad cache.
Event_OnNativeAdActive Action Raised when any NativeAdHolder component gets activated in the scene.
Event_AdLoaded Action Raised when the referenced NativeAdHolder component receives its Ad fill from ad cache.
Event_AdFailed Deprecated API from legacy versions of SDK. Avoid using this event as it will be removed from future versions.
Event_AdImpression Action Raised when the referenced NativeAdHolder component registers an impression for the loaded Ad.
Event_AdClicked Action Raised when the referenced NativeAdHolder component registers click for the active Ad.
Event_OnAdPaid Action Raised when the impression level revenue is available for the current impression.

** Please make sure to subscribe to Event_AdRequest in the Awake() callback to not miss the Auto-Fetch ad requests that is triggered in OnEnable() **

Clone this wiki locally