Skip to main content

OwAd

note

OwAd is an instance of an Overwolf Managed Ads Container. These can be created using the Overwolf Ads SDK.

Methods Reference

Events Reference

Subscribing To Events

Unlike with "native" Overwolf APIs, subscribing to events in the Ads SDK is done using the OwAd.addEventListener() method on the specific OwAd instance.

Types Reference

new OwAd(container, settings)

Creates a new instance of OwAd.

ParameterTypeDescriptionRequired
containerDOM ElementThe Ad's container elementYes
settingsContainerSettingsThe container's desired size configuration(s)No (defaults to a 400x300 Ad container if left empty)

Code Example

Creates a new OwAd, with the element ad-div as its container, with a container size of 400x300
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

Shut Down an existing OwAd instance
let owAd = new OwAd(...);
...

owAd.shutdown();

addEventListener(event, callback)

Adds a listener to a certain Ad event.

ParameterTypeDescriptionRequired
eventstringThe name of the event to listen toYes
callback(Result) => voidThe callback that will be called when this event occursYes

Code Example

Add an event listener to an OwAd
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.

note

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.

ParameterTypeDescription
sizeContainerSizeThe size of Ad containers that this Ad container can become. See Available Ad Sizes

ContainerSize Object

Width/height settings of an Ads container.

ParameterTypeDescription
widthnumberWidth of the target Ad container size
heightnumberHeight of the target Ad container size

Available Ad sizes:

The following Ad container sizes are currently supported by the Ads SDK:

Container sizeSupported video AdsSupported banner Ads(ow-plat) Size value snippet(ow-electron) Container min size snippet
400x300400x300 / 300x250336x280 / 300x250 / 250x250{ width: 400, height: 300 }min-width: 400px; min-height: 300px;
400x600400x300 / 300x250336x280 / 300x600 / 300x250 / 250x250{ width: 400, height: 600 }min-width: 400px; min-height: 600px;
300x250N/A300x250 / 250x250{ width: 300, height: 250 }min-width: 300px; min-height: 250px;
160x600N/A160x600 / 120x600{ width: 160, height: 600 }min-width: 160px; min-height: 600px;
728x90N/A728x90{ width: 728, height: 90 }min-width: 728px; min-height: 90px;
Ad Sizes Are Precise!

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.