Overview
Native ads are customizable ads that blend naturally with your app’s content. You can configure the ad to match your app’s UI usingAdropNativeAd and AdropNativeAdView.
Key Features
- Customizable layout to match app design
- Provides various elements like headline, body, CTA button, profile, etc.
- Supports image and HTML creative
- Custom click handling support
- Backfill ad support
Use the test unit ID in development:
PUBLIC_TEST_UNIT_ID_NATIVEAdropNativeAd
Constructor
| Parameter | Type | Required | Description |
|---|---|---|---|
unitId | String | Y | Unit ID created in Ad Control Console |
useCustomClick | bool | N | Whether to use custom click handling (default: false) |
preferredAdChoicesPosition | AdropAdChoicesPosition | N | AdChoices badge position for backfill native ads (default: AdropAdChoicesPosition.topRight) |
listener | AdropNativeListener | N | Ad event listener |
Properties
| Property | Type | Description |
|---|---|---|
isLoaded | bool | Whether the ad has finished loading |
unitId | String | Ad unit ID |
creativeId | String | Creative ID |
txId | String | Transaction ID |
campaignId | String | Campaign ID |
destinationURL | String | Destination URL |
properties | AdropNativeProperties | Native ad properties |
creativeSize | CreativeSize | Creative size |
isBackfilled | bool | Whether it’s a backfill ad |
browserTarget | BrowserTarget? | Browser target (external or internal) |
Methods
| Method | Return Type | Description |
|---|---|---|
load() | Future<void> | Loads the ad |
Unlike other ad types (
AdropInterstitialAd, AdropRewardedAd, AdropPopupAd), AdropNativeAd does not provide a dispose() method.
To load a new ad, create a new AdropNativeAd instance. Resources from previous instances are automatically released by the garbage collector.AdropNativeAdView
A widget that displays native ads on screen.Constructor
| Parameter | Type | Required | Description |
|---|---|---|---|
ad | AdropNativeAd? | Y | Loaded native ad object |
child | Widget | Y | Child widget to display ad content |
AdropNativeProperties
Content properties of the native ad.Properties
| Property | Type | Description |
|---|---|---|
headline | String? | Ad headline |
body | String? | Ad body text |
creative | String? | HTML creative content |
asset | String? | Image asset URL |
destinationURL | String? | URL to navigate on click |
callToAction | String? | CTA button text |
profile | AdropNativeProfile? | Advertiser profile information |
extra | Map<String, String> | Additional custom fields |
isBackfilled | bool | Whether it’s a backfill ad |
AdropNativeProfile
| Property | Type | Description |
|---|---|---|
displayName | String? | Advertiser name |
displayLogo | String? | Advertiser logo image URL |
Basic Usage
AdropNativeListener
Listener to handle native ad events.Callbacks
Callback Descriptions
| Callback | Description |
|---|---|
onAdReceived | Called when ad is received successfully |
onAdClicked | Called when ad is clicked |
onAdImpression | Called when ad impression occurs |
onAdFailedToReceive | Called when ad fails to receive |
onAdVideoStart | Called when video ad starts playing |
onAdVideoEnd | Called when video ad finishes playing |
Custom Click Handling
UseuseCustomClick when video creative or custom click behavior is needed.
useCustomClick is true, child widget click events are handled as ad clicks.
Displaying HTML Creative
If the native ad includes HTML creative, you can display it using WebView.To use HTML creative, you need to add the
webview_flutter package.Handling Backfill Ads
You can check and handle backfill ads using theisBackfilled property.
AdChoices Position
For backfill native ads, you can choose which corner displays the AdChoices badge. SetpreferredAdChoicesPosition in the AdropNativeAd constructor.
| Value | Description |
|---|---|
AdropAdChoicesPosition.topLeft | Top-left corner |
AdropAdChoicesPosition.topRight | Top-right corner (default) |
AdropAdChoicesPosition.bottomLeft | Bottom-left corner |
AdropAdChoicesPosition.bottomRight | Bottom-right corner |
This setting is a preferred hint for the backfill network and applies only to backfill native ads — direct ads are not affected. The backfill network may override the position depending on its policy.
Video Tracking and VTR
Adrop measures video metrics for native creatives — including impression-to-completion (VTR),onAdVideoStart, and onAdVideoEnd — only when the video is rendered through the SDK’s media surface. On Flutter, that means rendering the HTML creative (properties.creative) inside a WebView, as shown in Displaying HTML Creative.
The properties.asset field returns a URL pointing to the underlying image or video file. It is exposed as supplementary metadata (for example, for thumbnails or your own analytics); it is not intended to drive playback.
Recommended pattern
For video creatives, follow the WebView + HTML creative pattern:AdropNativeAdView so that click and impression tracking stay attached to the ad container.
If a placement absolutely requires a custom player and you accept that VTR will not be measured, you can still surface click and impression attribution by keeping the ad bound to
AdropNativeAdView. In that case, treat the placement as non-VTR inventory in your internal reporting and avoid mixing it with SDK-measured video performance.Using Extra Fields
Additional fields defined by publishers can be accessed from theextra map.
Error Handling
Backfill-Related Errors
When backfill ads are configured, thebackfillNoFill error code is returned when both direct ads and backfill ads are unavailable.
General Error Handling
Best Practices
1. Recreating Ads
To load a new ad, create a newAdropNativeAd instance.
2. Conditional Rendering
Display an appropriate placeholder until the ad loads.3. Responsive Layout
Configure layout to adapt to various screen sizes.4. Null Check for Ad Properties
Native ad properties can be null, so always check them.Next Steps
Interstitial Ads
Implement full-screen interstitial ads
Rewarded Ads
Implement rewarded ads that provide rewards
Popup Ads
Implement popup-style ads
Reference
Reference types, methods, and error codes