Installation

Just download mockingbird.js (or mockingbird.min.js) and add it to your website. Then execute the only method "adsBlocked" with its parameters upon your desire.

Javascript code example

Method Properties

Anywhere on the html of your site you can initiate mockingbird script with the method adsBlocked. It receives an object which can have the following properties:

containers [array]

This is an array of Ads containers. Each ad container will be an object with the following properties:

  • selector: [string | jQueryObject] - Default: null -> css selector that will match containers. It is possible for this to be a jQuery object like $('.div1')
  • src: string - Default: null -> ONLY for mockingbird Ad Server integration, this let's load dynamic banners even when ad blockers enabled
  • img: string - Default: null -> relative or absolute url PATH of the image that will replace the Ad if ad blocker enabled
  • link: string - Default: null -> full url of the ad destination
  • title: string - Default: 'link' -> title of the tag
  • replaceContents: boolean - Default: true -> will replace all the content of the containers that match the selector
  • msg: string - Default: null -> The message to be displayed if ad blocker enabled. Also accepts html markup string
  • classes: obj - Default: null -> Object with classes properties
    • container: string - Default: null -> The class that will be added to the containers matched in "selector" property if ads blocked
    • msg: string - Default: null -> The class that will be added to the message if ads blocked
popup [object]

This is the popup object that will define the popup behaviour, can be a full page popup or a small notification on the top of the page. It has the following properties:

  • title: string - Default: null -> [Only for type:'full']. Is the title of the popup window. Also accepts html markup string
  • buttonLabel: string - Default: 'Cancel' -> [Only for type:'full' and exitButton: true]. This is the button label. Also accepts html markup string
  • msg: [string] - Default: null -> This is the main message that will be displayed on the popup. Also accepts html markup string
  • type: string - Values: ['full','small'] - Default: 'small' -> The popup type. 'full' is a popup that occupies the whole page, 'small' is a small text on the top of the page
  • exitButton: boolean - Default: true -> Enables/disables a button to close the popup
  • classes: object - Default: null -> Object with classes properties
    • title: string - Default: null -> [Only for type:'full']. Removes default css of popup title and adds the value as class
    • msg: string - Default: null -> Removes default css of popup message and adds the value as class
    • container: string - Default: null -> Removes default css of popup container and adds the value as class
    • exitButton: string - Default: null -> [Only for exitButton: true]. Removes default css of popup close button and adds the value as class
handler function

Default: null -> Handler to be executed after checking if ad blocker enabled. This function receives one boolean parameter, true if user has an ad blocker, false if not

requestValidation boolean

Default: false -> Enables/disables an http request to a local fake url with common adds tags. This ensures a secondary ad blocker detection.

You have to put either img and link properties, or msg property, one of them is mandatory for the plugin to work. If image is provided then link should be provided as well.

Browser support

Mockingbird works on the following browsers:

  • Chrome
  • Firefox
  • Opera
  • Safari
  • IE 8+

How it works

iso_mockingbirdMockingbird uses two different ways for detecting ad block. First by containers with common ads classes, and then it optionally falls back into a request to a local fake url with many common adds tags

Spread the love

Mockingbird is an open source project. You can help us sharing this page or following our progress on Github. Star or Follow using the buttons bellow.

Recommendations

Download the file and change its name from mockingbird to something else so ad blockers won't block the load of the script. Also you can rename the method "adsBlocked" to anything else inside mockingbird.js and then rename it also on your html code.

Data

The adblockers have become a major challenge for Publishers. It is estimated, on a global scale, the loss of advertising revenue due to the use of ad blockers is close to U$ 22 billion.  More Info

Latest updates

DMP integration

2016/02/22

Integration with Retargetly’s DMP to get stats about traffic with ad blockers, impressions and clicks counters served to those users, a/b testing of ads and messages, possibility to change messages whithin the platform without changing site code.

Optional parameter

2016/02/22

New optional parameter ‘redirect URL’ so, if present, all traffic with ad blockers enabled goes to that URL until gets ad blocker disabled.