Version: 2.67.0

Adblock detection

The THEOplayer Ads API allows developers to detect adblockers, and react accordingly.

Adblock detection


Web SDKAndroid SDKiOS SDKtvOSAndroid TV SDKChromecast SDK

Adblock detection is typically a challenge in browsers. Hence, SDKs besides the Web SDK are considered 'not applicable'.


Below are some resources on adblock detection through the Ads API:

Code examples


The below code snippet uses the aderror event to detect ad blockers, and blockContentIfAdError to halt playback in-case of an adblocker.

// add an eventlistener to get custom behavior if there is an ad error"aderror", function(event) {
// do something
// set the player source with ads and the blockContentIfAdError property
player.source = {
sources: {
ads: [
// set this to true if you want to block the content
// default value is false
blockContentIfAdError: true

Note that blockContentIfAdError only works when you use the default advertisement integration. If you'd use Google IMA (or any other integration), you'll have to use the aderror event to halt playback.