{"_id":"@ad-shield/adblock-detector","_rev":"2-5ffcdca4ea91fa83187601cec61805d6","name":"@ad-shield/adblock-detector","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@ad-shield/adblock-detector","version":"0.0.1","keywords":["adblock","ad-blocker","detection","advertising","blocker"],"author":{"name":"Ad-Shield"},"license":"MIT","_id":"@ad-shield/adblock-detector@0.0.1","maintainers":[{"name":"adshield-dev","email":"team@ad-shield.io"}],"homepage":"https://github.com/ad-shield/adblock-detector#readme","bugs":{"url":"https://github.com/ad-shield/adblock-detector/issues"},"dist":{"shasum":"04d0644d8d8b56ce96669be67590916b21f3963d","tarball":"https://registry.npmjs.org/@ad-shield/adblock-detector/-/adblock-detector-0.0.1.tgz","fileCount":12,"integrity":"sha512-I+FCER1nwROdkQYX0Hujhf+U6q7UKqq/Kd4uYHtsKYsEy+7V2xDXZysf4hd3rzQxSt02c6RgEP3sgFtAYX+G4A==","signatures":[{"sig":"MEQCIHfcEnPUmGapxzRJH++r6Sq+aDdPzq4pyd1gQ5Ta39HhAiBGJ+PZQMkzv3u/0T2NGMaS2UvpBm+3b6/ijvUSwTgq7g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":70091},"main":"src/index.js","type":"module","types":"src/index.d.ts","module":"src/index.js","browser":"dist/index.min.js","engines":{"node":">=14.0.0"},"exports":{".":{"types":"./src/index.d.ts","import":"./src/index.js","browser":"./dist/index.min.js","default":"./src/index.js"}},"gitHead":"2d72197ecf16b94e9789dc16b249e31e01d1c08e","scripts":{"lint":"eslint src/**/*.js","test":"playwright test --config=test/playwright.config.js","build":"rollup -c","test:ci":"playwright test --config=test/playwright.config.js --reporter=list","lint:fix":"eslint src/**/*.js --fix","test:setup":"node test/setup-extensions.js","build:watch":"rollup -c --watch","prepublishOnly":"npm run lint && npm run build"},"_npmUser":{"name":"adshield-dev","email":"team@ad-shield.io"},"repository":{"url":"git+https://github.com/ad-shield/adblock-detector.git","type":"git"},"_npmVersion":"10.8.2","description":"A lightweight, accurate adblock detection library","directories":{},"sideEffects":false,"_nodeVersion":"18.20.8","_hasShrinkwrap":false,"devDependencies":{"eslint":"^8.57.0","rollup":"^4.9.0","@playwright/test":"^1.40.0","@rollup/plugin-terser":"^0.4.4"},"_npmOperationalInternal":{"tmp":"tmp/adblock-detector_0.0.1_1765399010823_0.7524184213679024","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@ad-shield/adblock-detector","version":"0.0.2","description":"A lightweight, accurate adblock detection library","main":"src/index.js","module":"src/index.js","type":"module","types":"src/index.d.ts","browser":"dist/index.min.js","sideEffects":false,"exports":{".":{"types":"./src/index.d.ts","import":"./src/index.js","browser":"./dist/index.min.js","default":"./src/index.js"}},"scripts":{"build":"rollup -c","build:watch":"rollup -c --watch","lint":"eslint src/**/*.js","lint:fix":"eslint src/**/*.js --fix","test":"playwright test --config=test/playwright.config.js","test:setup":"node test/setup-extensions.js","test:ci":"playwright test --config=test/playwright.config.js --reporter=list","prepublishOnly":"npm run lint && npm run build"},"keywords":["adblock","ad-blocker","detection","advertising","blocker"],"author":{"name":"Ad-Shield"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/ad-shield/adblock-detector.git"},"engines":{"node":">=14.0.0"},"devDependencies":{"@playwright/test":"^1.40.0","@rollup/plugin-terser":"^0.4.4","eslint":"^8.57.0","rollup":"^4.9.0"},"_id":"@ad-shield/adblock-detector@0.0.2","gitHead":"2d72197ecf16b94e9789dc16b249e31e01d1c08e","bugs":{"url":"https://github.com/ad-shield/adblock-detector/issues"},"homepage":"https://github.com/ad-shield/adblock-detector#readme","_nodeVersion":"18.20.8","_npmVersion":"10.8.2","dist":{"integrity":"sha512-ypsOTmnGW2TCu1aMl1s0tS2kTyCHxm1B4zxH+4a8hJLlSd6UeATWN9tHJhXtPUJhi39fQN9FXjBv9du7DbVrlg==","shasum":"7860ae565b28cc837552bc3ebe4ba9512dde2d62","tarball":"https://registry.npmjs.org/@ad-shield/adblock-detector/-/adblock-detector-0.0.2.tgz","fileCount":12,"unpackedSize":70091,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHcJywbIvtAHd6gmRHU+Lr37dcfP5Zf8kH+6g0g/hoTuAiA/I5CBAQJ8qfCD5G5CJCoERhOgEdWWXgntUXLazNKuGg=="}]},"_npmUser":{"name":"adshield-dev","email":"team@ad-shield.io"},"directories":{},"maintainers":[{"name":"adshield-dev","email":"team@ad-shield.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/adblock-detector_0.0.2_1765399599113_0.8108876589226803"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-10T20:36:50.726Z","modified":"2025-12-10T20:46:39.521Z","0.0.1":"2025-12-10T20:36:50.958Z","0.0.2":"2025-12-10T20:46:39.262Z"},"bugs":{"url":"https://github.com/ad-shield/adblock-detector/issues"},"author":{"name":"Ad-Shield"},"license":"MIT","homepage":"https://github.com/ad-shield/adblock-detector#readme","keywords":["adblock","ad-blocker","detection","advertising","blocker"],"repository":{"type":"git","url":"git+https://github.com/ad-shield/adblock-detector.git"},"description":"A lightweight, accurate adblock detection library","maintainers":[{"name":"adshield-dev","email":"team@ad-shield.io"}],"readme":"<p align=\"center\">\n  <a href=\"https://www.ad-shield.io/\">\n    <picture>\n      <source media=\"(prefers-color-scheme: dark)\" srcset=\"resources/logo-dark-mode.png\" />\n      <img src=\"resources/logo-light-mode.png\" alt=\"Ad-Shield logo\" width=\"312px\" />\n    </picture>\n  </a>\n</p>\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/@ad-shield/adblock-detector\"><img src=\"https://img.shields.io/npm/v/@ad-shield/adblock-detector.svg\" alt=\"Current NPM version\"></a>\n  <a href=\"https://www.npmjs.com/package/@ad-shield/adblock-detector\"><img src=\"https://img.shields.io/npm/dm/@ad-shield/adblock-detector.svg\" alt=\"Monthly downloads from NPM\"></a>\n  <a href=\"https://www.jsdelivr.com/package/npm/@ad-shield/adblock-detector\"><img src=\"https://img.shields.io/jsdelivr/npm/hm/@ad-shield/adblock-detector.svg\" alt=\"Monthly downloads from jsDelivr\"></a>\n  <a href=\"https://github.com/ad-shield/adblock-detector/blob/main/LICENSE\"><img src=\"https://img.shields.io/npm/l/@ad-shield/adblock-detector.svg\" alt=\"License\"></a>\n</p>\n\n<p align=\"center\">\n  The most accurate and efficient open-source adblock-detector — continuously updated to stay ahead of the latest ad-blockers. Built and maintained by <a href=\"https://www.ad-shield.io\">Ad-Shield</a>.\n</p>\n\n## Installation\n\n```bash\nnpm install @ad-shield/adblock-detector\n```\n\n## Quick Start\n\n### ES Modules\n\n```javascript\nimport { detectAdblock } from \"@ad-shield/adblock-detector\";\n\nconst result = await detectAdblock();\nif (result.isAdBlocked) {\n  console.log(\"Ad blocker detected\");\n}\n```\n\n### React\n\n```jsx\nimport { useEffect, useState } from \"react\";\nimport { detectAdblock } from \"@ad-shield/adblock-detector\";\n\nfunction App() {\n  const [adblockDetected, setAdblockDetected] = useState(false);\n\n  useEffect(() => {\n    detectAdblock().then((result) => {\n      setAdblockDetected(result.isAdBlocked);\n    });\n  }, []);\n\n  return (\n    <div>\n      {adblockDetected && (\n        <div className=\"adblock-warning\">\n          Please disable your ad blocker to support our site.\n        </div>\n      )}\n    </div>\n  );\n}\n```\n\n### Browser (CDN)\n\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/@ad-shield/adblock-detector@latest/dist/index.min.js\"></script>\n<script>\n  window.adblockDetector.detectAdblock().then((result) => {\n    if (result.isAdBlocked) {\n      console.log(\"Ad blocker detected\");\n    }\n  });\n</script>\n```\n\n## API\n\n### `detectAdblock(options?)`\n\nReturns a Promise that resolves to a detection result.\n\n**Parameters:**\n\n- `options` (optional): Configuration object\n  - `acceptableAdsTestUrls` (optional): Array of exactly 2 URLs for Acceptable Ads detection. Defaults to standard test URLs.\n\n**Returns:** `Promise<DetectionResult>`\n\n```typescript\ninterface DetectionOptions {\n  acceptableAdsTestUrls?: readonly [string, string];\n}\n\ninterface DetectionResult {\n  isAdBlocked: boolean; // True if ad blocker is detected\n  isAcceptableAdsBlocked: boolean; // True if acceptable ads are also blocked\n}\n```\n\n**Example:**\n\n```javascript\n// Basic usage\nconst result = await detectAdblock();\nconsole.log(result.isAdBlocked); // true or false\nconsole.log(result.isAcceptableAdsBlocked); // true or false\n\n// With custom Acceptable Ads test URLs\nconst result = await detectAdblock({\n  acceptableAdsTestUrls: [\n    \"https://example.com/test1.gif\",\n    \"https://example.com/test2.gif\",\n  ],\n});\n```\n\n## Open Source vs. Ad-Shield\n\nThis open-source library provides accurate adblock detection, but for production-grade solutions with advanced features, consider [Ad-Shield](https://www.ad-shield.io/contact).\n\n| Feature                   | Open Source      | Ad-Shield                                  |\n| ------------------------- | ---------------- | ------------------------------------------ |\n| **Detection Accuracy**    | High             | Highest (continuously updated)             |\n| **Dashboard & Analytics** | ❌ Not available | ✅ Daily analytics & reporting             |\n| **Adblock Recovery**      | ❌ Not available | ✅ Ads work normally even with ad blockers |\n| **Support & Updates**     | Community        | ✅ Dedicated support & priority updates    |\n\n## License\n\nMIT © [Ad-Shield](https://www.ad-shield.io)\n","readmeFilename":"README.md"}