Warning
This project is under active development!
A simple JavaScript library to detect if a user has an AdBlocker installed in their browser.
npm install adblock-cry-cry
import AdBlockCryCry from "adblockcrycry";
const detector = new AdBlockCryCry();
detector.init(async () => {
const isAdblock = await detector.detect();
if (isAdblock) {
console.log("AD Blocker detected!");
// Take appropriate action
} else {
console.log("No AD Blocker detected!");
}
});
Creates an instance of the AdBlockCryCry detector.
Parameter | Type | Default | Description |
---|---|---|---|
img |
string |
"/ads.jpg" |
Path to a dummy ad image used for detection |
elementIds |
Array<string> |
[] |
Additional ad-related element IDs to check |
gtmId |
string |
"" |
Google Tag Manager container ID used for detecting GTM blocking |
isCheckFacebook |
boolean |
true |
Checkout Facebook Pixel source status |
MIT