Implementation Methods
Native ads allow you to display ads with custom UI that matches your app’s design.| Method | Description | Recommended |
|---|---|---|
| Default Template | Use SDK-provided template | Quick implementation |
| Custom UI | Build your own UI | When design customization is needed |
Use the test unit ID in development:
PUBLIC_TEST_UNIT_ID_NATIVEDefault Template
You can use the default template in the same way as banner ads. Images and text are automatically rendered in the SDK-provided template.The default template does not support advertiser profile sections. Use custom UI to display advertiser profiles.
Custom UI
Data Attributes Method
Add thedata-adrop-render="custom" attribute and bind fields using data-adrop-native attributes on inner elements.
Data Attributes
Unit ID created in Ad Control Console
Set to
custom for custom UIContext ID for contextual targeting
Theme setting (
light or dark)Enable entire area click
false: Only text/images are clickable, clicking advertiser profile goes to profile linktrue: Entire container is clickable, all clicks go to ad destination
Enable custom click handling - When
true, SDK will not automatically navigate to the destination URL on click, only emit adClicked event. Allows developers to implement custom click behavior.renderAd Method
Use this when you want direct control over ad loading timing.renderAd Options
Unit ID created in Ad Control Console
User identifier (used to override SDK-level setting for individual placements)
Context ID for contextual targeting
Set to
1 for custom UIEnable entire area click
Theme setting (
light or dark)Enable custom click handling - When
true, SDK will not automatically navigate to the destination URL on click, only emit adClicked event with destination URL. Allows developers to implement custom click behavior.Field Binding
Bind ad data to UI elements using thedata-adrop-native attribute.
| Field | Description | Element Type |
|---|---|---|
profile.displayLogo | Advertiser logo URL | <img> |
profile.displayName | Advertiser name | Text |
headline | Ad title | Text |
body | Ad description | Text |
asset | Main image URL | <img> |
callToAction | CTA button text | Text |
extra.{key} | Extra text items | Text |
extra.{key} is the ID of extra text items set in Ad Control Console. It may be empty if not set as required.To display advertiser profile (
profile.displayLogo, profile.displayName), you must enable Show Advertiser Profile for that ad unit in Ad Control Console.Ad Size
Custom UI size can be set freely.| Type | Size Setting | Alignment |
|---|---|---|
| Direct Ads | Responsive support | Horizontal/Vertical center |
| Backfill Ads | Initial width matching, height required | Horizontal center |
Backfill ads request creatives matching the container size. Specify an appropriate size.
Fetching Data Only with requestAd
If you want complete control over the UI, you can fetch only the ad data usingrequestAd.
AdropAdResponse
Return value ofrequestAd().
| Field | Type | Description |
|---|---|---|
code | number | Response code (0: success, 4000-4003: error) |
msg | string | Response message |
result | AdData | Ad data (only present on success) |
AdData
Ad data object. Event handlers also receive the same structure. See Reference > AdData for the complete interface definition.| Field | Type | Description |
|---|---|---|
format | string | Ad format (banner, nativeAd, backfill) |
unit | string | Unit ID |
headline | string | Ad title |
body | string | Ad description |
callToAction | string | CTA button text |
asset | string | Main image URL |
destinationURL | string | Click destination URL |
profile.displayLogo | string | Advertiser logo URL |
profile.displayName | string | Advertiser name |
profile.link | string | Advertiser profile link |
extra | Record<string, string> | Extra text items |
Event Handling
Supported Events
| Event | Constant | Description |
|---|---|---|
| Ad Received | AD_RECEIVED | Ad request successful |
| No Ad | AD_NO_FILL | No direct ads available |
| Request Failed | AD_FAILED | Ad request failed |
| Impression | AD_IMPRESSION | Ad impression recorded |
| Click | AD_CLICKED | User clicked the ad |
| No Backfill | AD_BACKFILL_NO_FILL | No backfill ad available |
Custom Click Handling
WhenuseCustomClick is enabled, the SDK will not automatically navigate to the destination URL. Instead, you can handle the click event and implement custom behavior.
With custom click handling enabled, you have full control over what happens when users click the ad. The
destinationURL is provided in the adClicked event data.