Version:

Detect Ad-blocked Pages

Detect ad-blocked pages via the RudderStack JavaScript SDK.

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 ad blockers.

Send 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
        }
    },
    ...
});

The properties included in the above snippet are explained below:

PropertyDescription
sendAdblockPageEnables the JavaScript SDK to send an additional page event along with the actual event whenever you make the page call and the SDK detects that ad blockers are active on that web page.
sendAdblockPageOptionsThe JavaScript SDK makes an implicit page call with the specified options.

With sendAdblockPageOptions (containing the IntegrationOpts object), you can specify the destinations to which you want to forward this page call. See Filtering selective destinations for more information.

The implicit page call semantics are shown:

rudderanalytics.page(
    "RudderJS-Initiated",
    "ad-block page request", {
        path: "/ad-blocked"
    },
    sendAdblockPageOptions
);

Questions? Contact us by email or on Slack