Hello all, I'm trying to use your JS SDK API to de...
# support
i
Hello all, I'm trying to use your JS SDK API to detect the presence of Adblocker on the pages, but I'm not able to get it to work. My
load
function looks like this
Copy code
e.load(WRITE_KEY, DATAPLANE_URL, {	configUrl: DATAPLANE_URL, sendAdblockPage: true, sendAdblockPageOptions: {} });
When I read your documentation here, I can see that the SDK relies on calling google-analytics script in order to decide whether the adblock is active or not. However, I don't see this script being fetched. Is there a way I can debug this? Or is there something I'm missing? Thanks.
When I say I don't see it being fetched, I confirm this by checking the network tab. It's not same as being blocked, I think. If it were the case, I should've still seen the request being made, with a tag saying that this request was blocked by adblocker.
Hey @shy-kite-21035 Thanks for looking into it. I haven't tried it while using the
page()
call. I tried this from the documentation: https://www.rudderstack.com/docs/sources/event-streams/sdks/rudderstack-javascript-sdk/detecting-adblocked-pages/ Is that an expected behaviour and we need to use the implicit
page()
call mentioned here? If so, docs need some update. Otherwise, looks like
load()
is not making the implicit call.
@shy-kite-21035 As of now, I do this,
Copy code
e.load(WRITE_KEY, DATAPLANE_URL, {	configUrl: DATAPLANE_URL, sendAdblockPage: true, sendAdblockPageOptions: {} });
e.page();
And I don't see the google-analytics request. How are you checking this btw? Networks tab?
When I make
page()
like mentioned in the documentation,
Copy code
rudderanalytics.page(
    "RudderJS-Initiated",
    "ad-block page request", {
        path: "/ad-blocked",
        title: "error in script loading:: src::  http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js id:: ad-block"
    },
    sendAdblockPageOptions
);
I still don't see the request in networks tab. And every
page()
call is sending "ad-block page request" even when the ad blocker is enabled on the page or not.
There's something I'm not getting. Can you elaborate an example or github gist of basic setup with ad block detection, please?
Thanks