Overview
Native ads are ad formats that naturally integrate with your app’s UI. You can freely customize ad elements (title, image, description, etc.) to match your app design.Key Features
- Custom design that perfectly integrates with app UI
- Individual access and placement of ad elements
- Option to display advertiser profile information
- Support for additional custom fields
Implementation Steps
Native ad implementation proceeds in the following steps:- Load ad
- Create custom view
- Bind view
- Handle delegates
1. Load Ad
Create anAdropNativeAd instance and load the ad.
Set Context ID
You can set a Context ID for contextual targeting.Use test unit IDs during development. See the Test Unit IDs section.
2. Create Custom View
Compose your native ad view using Storyboard or code.UIKit (Storyboard/XIB)
CreateAdropNativeAdView in Storyboard and connect ad elements as IBOutlets.
UIKit (Code)
3. Bind View
Bind ad elements toAdropNativeAdView to display ad data.
Binding Methods
The
onClick closure is called when the user taps the bound view. It receives the current AdropNativeAd? instance and the tapped UIView as parameters. If not provided, the default click behavior (opening the destination URL) is used.To display advertiser profile, you must enable Show Advertiser Profile for the ad unit in Ad Control Console.
4. Handle Delegates
ImplementAdropNativeAdDelegate to handle ad events.
Delegate Methods
Closure Callbacks
As an alternative to delegates, you can use closure-based callbacks.If both a delegate and closures are set, both will be called.
Ad Properties
You can access ad data through theAdropNativeAd object.
Basic Properties
Advertiser Profile
Custom Fields
You can access additional text items set in Ad Control Console.The
extra field uses additional text item IDs defined in the ad unit settings in Ad Control Console as keys.Property List
AdropNativeAdProfile
Custom Click
You can use Custom Click to handle ad click behavior yourself instead of using the default behavior (opening the destination URL).Setup
Entire Click Area
UsesetIsEntireClick(_:) to make the entire AdropNativeAdView clickable.
When
useCustomClick is true, setIsEntireClick(true) is automatically called in setNativeAd(_:).Manual Click
UseperformClick() to manually trigger a click event.
Open URL
Useopen(_:useInAppBrowser:) to open a URL programmatically.
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 (a UIView bound via AdropNativeAdView.setMediaView(_:)). This applies to the ad’s main media (Media 1). For the other media items of a multi-media creative, see Multi-Media Creatives.
The AdropNativeAd.asset property 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
Bind the SDK media surface for every video native: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.Multi-Media Creatives
Requires the iOS SDK (
adrop-ads) 1.16.0 or later. If you use backfill, update adrop-ads-backfill to the same version.extraAssets holds every media item of the ad, keyed by the media ID set in the console. Media 1 is always m1, and the other media items use the IDs shown in Media Size on the Ad Unit detail screen, such as m2 and m3.
- Media 1 (
m1) is the same media asassetandcreative. Keep displaying it with the media view you pass tosetMediaView(_:), and draw only the other media items yourself. extraAssetsis empty for creatives of units with a single media item and for backfill ads. Display those ads as usual.extraAssetsis a dictionary, so its order isn’t guaranteed. Look up media items by ID.- If the ad is served in dark mode, image media items are dark mode images too.
- To check your layout with a multi-media creative, preview the creative on a test device.
AdropNativeAsset
Displaying Media Items
- Image: Call
setIsEntireClick(true)before you register views withsetHeadLineView(_:)and the otherset…Viewmethods. Media items you draw aren’t views registered with the SDK, so in the default click mode a tap on them isn’t counted as a click. With entire click, if Media 1 is a video, its player controls don’t respond to taps. Don’t load thecreativeHTML of an image: it doesn’t report clicks to Adrop. - Video: Play the
creativeHTML, not theassetURL. The HTML contains the video player and its tracking, so video metrics are measured only through it. Place theWKWebViewoutsideAdropNativeAdView: inside, entire click turns every tap, including taps on the player’s controls, into an ad click. Load the HTML when the ad is about to appear on screen, not in advance. - Landing page: When a user taps the video, its HTML reports the click and asks to open the landing page in a new window or in the same window. Handle both in
webView(_:createWebViewWith:for:windowFeatures:)andwebView(_:decidePolicyFor:decisionHandler:), and open the URL withopen(_:useInAppBrowser:)ofAdropNativeAd, which follows the creative’s browser setting.
Impressions and Clicks
Impressions, clicks, and video metrics are counted once per ad, not per media item, even when both the SDK and a media item report them.Which taps on a video count as clicks depends on the unit’s video controller setting. With the controller off, every tap on the video is a click. With it on, taps on the play and mute controls aren’t clicks.
Example
This example shows Media 2 (m2) as an image inside AdropNativeAdView, or as a video in a container placed right below AdropNativeAdView. Replace m2 with the ID of your unit’s media item.
In a
UITableView or UICollectionView, create the media item’s WKWebView when you configure the cell and remove it in prepareForReuse().Best Practices
Error Handling
Display fallback UI when ad fails to load to maintain user experience.Test Unit IDs
Use the following test unit IDs during development and testing.Batch Loading (loads)
UseAdropNativeAd.loads(...) to request multiple native ads in a single batched call. This is useful for prefetching a pool of ads to insert into feeds, carousels, or paginated lists.
Signature
Usage
Delegate Methods
Constants
Int
default:"5"
Upper bound on ads returned from a single
loads(...) call.Constraints
- Maximum 5 ads per call. If the server returns more, only the first 5 are delivered.
- Backfill is not applied. If no direct ads fill,
onAdsFailedToReceiveis called withERROR_CODE_AD_NO_FILLregardless of backfill configuration. - Unlike
AdropBanner.loads(...), the native batch waits for every returned ad to finish rendering before firingonAdsReceived(_:), so each instance is fully rendered on delivery. - Hold strong references to the returned ads. If they deallocate before being bound to an
AdropNativeAdView, they’re silently dropped.
Backfill Ads
When backfill ads are enabled, backfill ads are automatically loaded when direct ads are unavailable. Use theisBackfilled property to check if the ad is a backfill ad.
AdChoices Position
For backfill native ads, you can choose which corner displays the AdChoices badge. SetpreferredAdChoicesPosition on the AdropNativeAd instance before calling load().
This setting is a preferred hint for the backfill network and applies only to backfill native ads — direct ads are not affected. The value must be set before
load() is called. The backfill network may override the position depending on its policy.To use backfill ads, add the
AdropAds-Backfill dependency. See Getting Started.Related Documentation
Getting Started
SDK installation and initialization
Banner Ads
Implementing banner ads
Interstitial Ads
Implementing interstitial ads
Rewarded Ads
Implementing rewarded ads