Classes
Adrop
The main SDK class. Works as a singleton.Static Methods
| Method | Return Type | Description |
|---|---|---|
observe(config) | Adrop | Initialize SDK and start automatic DOM detection |
instance() | Adrop | Return existing instance |
Instance Methods
| Method | Return Type | Description |
|---|---|---|
renderAd(container, options?) | Promise<void> | Render ad |
requestAd(options) | Promise<AdropAdResponse> | Request ad data only |
clear(container) | void | Remove ad |
setConfig(config) | void | Update configuration |
on(event, callback, filter?) | void | Register event listener |
off(event, callback) | void | Unregister event listener |
Instance Properties
| Property | Type | Description |
|---|---|---|
uid | string | User identifier (getter/setter) |
appKey | string | API authentication key (getter/setter) |
metrics | AdropMetrics | User property management |
Interfaces
AdropConfig
SDK initialization options.AdropAdRequest
Ad request parameters.AdropAdResponse
Ad response object.AdData
Ad data object.AdropEventFilter
Event filter options.Constants
Adrop.Events
Event constants. Access viaAdrop.Events.
| Constant | Value | Description |
|---|---|---|
AD_RECEIVED | 'adReceived' | Ad received successfully |
AD_NO_FILL | 'adNoFill' | No direct ads |
AD_IMPRESSION | 'adImpression' | Ad impression |
AD_CLICKED | 'adClicked' | Ad click |
AD_FAILED | 'adFailed' | Ad request failed |
AD_BACKFILL_NO_FILL | 'adBackfillNoFill' | No backfill ads |
Adrop.ErrorCode
Error codes. Access viaAdrop.ErrorCode.
| Constant | Value | Description |
|---|---|---|
OK | 0 | Success |
ERROR_CODE_INVALID_UNIT | 4000 | Invalid unit ID |
ERROR_CODE_AD_INACTIVE | 4001 | No active campaigns |
ERROR_CODE_AD_NO_FILL | 4002 | No matching ads |
ERROR_CODE_INVALID_PARAMS | 4003 | Invalid parameters |