OwAd
OwAd
is an instance of an Overwolf Managed Ads Container.
These can be created using the Overwolf Ads SDK.
Methods Reference
Events Reference
Unlike with "native" Overwolf APIs, subscribing to events in the Ads SDK is done using the
OwAd.addEventListener() method on the specific OwAd
instance.
- OWAd.player_loaded (Video Only)
- OWAd.display_ad_loaded
- OWAd.play
- OWAd.impression (Video Only)
- OWAd.complete (Video Only)
- OWAd.error (Video Only)
Types Reference
- OwAd.ContainerSettings Object
- OwAd.ContainerSize Object
new OwAd(container, settings)
Creates a new instance of OwAd.
Parameter | Type | Description | Required |
---|---|---|---|
container | DOM Element | The Ad's container element | Yes |
settings | ContainerSettings | The container's desired size configuration(s) | No (defaults to a 400x300 Ad container if left empty) |
Code Example
let owAd = new OwAd(document.getElementById("ad-div"), {size: {width: 400, height: 300}});
shutdown()
Shuts down the Ads container completely.
For specific use cases, please refer to Guidelines for ad integration.
Code Example
let owAd = new OwAd(...);
...
owAd.shutdown();
addEventListener(event, callback)
Adds a listener to a certain Ad event.
Parameter | Type | Description | Required |
---|---|---|---|
event | string | The name of the event to listen to | Yes |
callback | (Result) => void | The callback that will be called when this event occurs | Yes |
Code Example
let owAd = new OwAd(...);
...
owAd.addEventListener("player_loaded", (name, ...) => {...});
player_loaded (Video Only)
Fires when a Video Ad's player is successfully loaded into the page.
display_ad_loaded
Fires when a Display Ad was served to the container.
play
Fires when an Ad started "playing" (Video Ad started playing, or display Ad was presented).
impression (Video Only)
Fires when a Video Ad triggered an Impression. This happens at different intervals depending on the advertiser.
complete (Video Only)
Fires when a Video Ad completely finished playing.
error (Video Only)
Fires if an error occured while loading a Video Ad.
The following events are supported in OW-Electron: player_loaded
, display_ad_loaded
, play
, complete
and impression
.
ContainerSettings Object
List of settings that can be used when setting up an OwAd instance.
Parameter | Type | Description |
---|---|---|
size | ContainerSize | The size of Ad containers that this Ad container can become. See Available Ad Sizes |
ContainerSize Object
Width/height settings of an Ads container.
Parameter | Type | Description |
---|---|---|
width | number | Width of the target Ad container size |
height | number | Height of the target Ad container size |
Available Ad sizes:
The following Ad container sizes are currently supported by the Ads SDK:
Container size | Supported video Ads | Supported banner Ads | (ow-plat) Size value snippet | (ow-electron) Container min size snippet |
---|---|---|---|---|
400x300 | 400x300 / 300x250 | 336x280 / 300x250 / 250x250 | { width: 400, height: 300 } | min-width: 400px; min-height: 300px; |
400x600 | 400x300 / 300x250 | 336x280 / 300x600 / 300x250 / 250x250 | { width: 400, height: 600 } | min-width: 400px; min-height: 600px; |
300x250 | N/A | 300x250 / 250x250 | { width: 300, height: 250 } | min-width: 300px; min-height: 250px; |
160x600 | N/A | 160x600 / 120x600 | { width: 160, height: 600 } | min-width: 160px; min-height: 600px; |
728x90 | N/A | 728x90 | { width: 728, height: 90 } | min-width: 728px; min-height: 90px; |
Make sure to only enter values from a single line of the Size value snippet
! Any unsupported values will potentially cause no ads to show!
For specific edge-cases, or if you wish to use several different sizes in a single container, contact us.