{"id":18817305,"url":"https://github.com/blueberryapps/detect-adblock","last_synced_at":"2025-04-13T22:56:17.952Z","repository":{"id":17877406,"uuid":"82905412","full_name":"blueberryapps/detect-adblock","owner":"blueberryapps","description":"Get information about whether the user has enabled AdBlock","archived":false,"fork":false,"pushed_at":"2022-12-06T16:10:34.000Z","size":206,"stargazers_count":24,"open_issues_count":5,"forks_count":2,"subscribers_count":28,"default_branch":"master","last_synced_at":"2025-03-27T13:12:23.412Z","etag":null,"topics":["adblock","blueberry-opensource","detector","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blueberryapps.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-23T08:44:23.000Z","updated_at":"2023-09-08T17:21:22.000Z","dependencies_parsed_at":"2023-01-11T19:43:04.891Z","dependency_job_id":null,"html_url":"https://github.com/blueberryapps/detect-adblock","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blueberryapps%2Fdetect-adblock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blueberryapps%2Fdetect-adblock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blueberryapps%2Fdetect-adblock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blueberryapps%2Fdetect-adblock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blueberryapps","download_url":"https://codeload.github.com/blueberryapps/detect-adblock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248794570,"owners_count":21162614,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adblock","blueberry-opensource","detector","javascript"],"created_at":"2024-11-08T00:10:48.801Z","updated_at":"2025-04-13T22:56:17.929Z","avatar_url":"https://github.com/blueberryapps.png","language":"JavaScript","readme":"# Detect AdBlock [![Dependency Status](https://dependencyci.com/github/blueberryapps/detect-adblock/badge)](https://dependencyci.com/github/blueberryapps/detect-adblock)\n\n```\nyarn add detect-adblock\n```\n\nDetectAdbblock is a library which recognizes using of ad blocker in a browser. You can use it in case you want to show advertisment towards users or just run important script which are beign blocked.\n\n# Motivation\n\nThis library is inspired by [BlockAdBlock project](https://github.com/sitexw/BlockAdBlock). Main changes are that this library is simplified, completely written in ES6 and contains tests written in Jest.\n\n# How to use\n\nTo use Detect AdBlock you need just to import `DetectAdblock` class to your project and then use it as a standard javascript class.\n\n## Constructor\n* `timeout` specifies number of `ms` to run check for, default is 1000.\n* `enabledHandler` is a callback which is called when no ad block is recognized.\n* `disabledHandler` is a callback which is called when no ad block is not recognized.\n\n## Methods\n* `startChecking(count)` is a method which starts checking for ad blockers. Count is the number of checks in one run. Default is 5.\n\n# Example\n\n```js\nimport DetectAdblock from '@blueberry/detect-adblock'\n\nconst onEnabled = () =\u003e console.log('ENABLED');\nconst onDisabled = () =\u003e console.log('DISABLED');\n\nconst check = () =\u003e {\n  // It is important to check wheter the script is rendered in the browser.\n  if (!process.env.IS_BROWSER) return;\n\n  const detector = new DetectAdblock(500, onEnabled, onDisabled);\n  detector.startChecking(3);\n  return;\n};\n```\n\n# Browser compatibility\nThe package should work in all modern browsers including IE8+.\n\n## Made with love by\n[![](https://camo.githubusercontent.com/d88ee6842f3ff2be96d11488aa0d878793aa67cd/68747470733a2f2f7777772e676f6f676c652e636f6d2f612f626c75656265727279617070732e636f6d2f696d616765732f6c6f676f2e676966)](https://www.blueberry.io)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblueberryapps%2Fdetect-adblock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblueberryapps%2Fdetect-adblock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblueberryapps%2Fdetect-adblock/lists"}