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, request?) | Promise<void> | Render ad |
requestAd(request) | Promise<AdropAdResponse> | Request ad data only (single) |
requestAds(request) | Promise<AdropAdsResponse> | Request multiple ads 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 |
AdropMetrics
User property management class.Methods
| Method | Return Type | Description |
|---|---|---|
setUserProperties(props) | AdropMetrics | Set user properties (chainable) |
setAppProperties(props) | AdropMetrics | Set app properties (chainable) |
commit() | Promise<void> | Save properties to server |
properties() | Properties | Return currently set properties (user + app + device) |
clear() | void | Clear user and app properties (device properties are retained) |
Interfaces
AdropConfig
SDK initialization options.AdropAdRequest
Ad request parameters.adId is the advertising identifier used by the View on Device feature to preview a draft creative on a registered test device. See the Preview Creatives on Test Device guide for setup. Do not ship to production with adId hard-coded.AdropAdResponse
Ad response object (single ad).AdropAdsResponse
Ad response object (multiple ads).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 |
AD_VIDEO_START | 'adVideoStart' | Video ad playback started |
AD_VIDEO_END | 'adVideoEnd' | Video ad playback ended |
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 |
Types
AdFormat
Ad format type.AdTheme
Theme type.BackfillMode
Backfill ad rendering mode type. (SDK 1.2.3+)Event Callbacks
Callback signatures for each event.All event callbacks receive
unit as the first argument. Events AD_RECEIVED, AD_IMPRESSION, AD_CLICKED, AD_VIDEO_START, and AD_VIDEO_END also receive adData as the second argument.