The JavaScript SDK lets you send a page view containing the relevant markers that determine whether a page is ad-blocked. You can analyze this data to find what percentage of your website's page views are affected by adblockers.

Sending an ad-blocked page view

To send an ad-blocked page view, load the JavaScript SDK as shown:

rudderanalytics.load(WRITE_KEY, DATA_PLANE_URL, {
sendAdblockPage: true,
sendAdblockPageOptions: {
integrations: {
All: false,
Amplitude: true
Replace WRITE_KEY and DATA_PLANE_URL in the above snippet with the actual values.

The properties included in the above snippet are explained below:

  • sendAdblockPage: Enables the JavaScript SDK to make a call to load the Google AdSense library. If RudderStack fails to load this library, it concludes that an adblocker is enabled on the page.
Since most adblockers block the request to the Google AdSense servers, this approach is assumed to be a good measure to detect the ad-blocked pages.
  • sendAdblockPageOptions: If the sendAdblockPage property is set to true, the JavaScript SDK makes an implicit page call about the ad-blocked pages.

With sendAdblockPageOptions (containing the IntegrationOpts object), you can specify the destinations to which you want to forward this page call.

Refer to the Filtering selective destinations guide for more information on filtering the destinations.

The implicit page call semantics is shown below:
"ad-block page request", {
path: "/ad-blocked",
title: "error in script loading:: src:: id:: ad-block"

Contact us

For more information on the topics covered on this page, email us or start a conversation in our Slack community.