Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,34 @@ Submit a pull request
- The script will not work locally. The page should get served from the server via http
- Currently the “baits” or “honey pods” used in the Javascript are hardcoded @ #218. If you want to update the file with new baits update the line #218
- Use the sample file test.html find in the repository. Host the file on HTTP server eg. apache server and request the file in browser via http with adblocker on/off.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

google.com, pub-5404878975756134, DIRECT, f08c47fec0942fa0

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

google.com, pub-5404878975756134, DIRECT, f08c47fec0942fa0


## GA4 Integration Example

Since Universal Analytics has been sunset by Google, modern implementations can use GA4 event tracking.

Example:

```javascript
window.adblockDetector.init({
found: function () {
if (typeof gtag === 'function') {
gtag('event', 'adblock_detected', {
adblock_status: 'detected'
});
}
},

notFound: function () {
if (typeof gtag === 'function') {
gtag('event', 'adblock_not_detected', {
adblock_status: 'not_detected'
});
}
}
});
```

## Google Tag Manager (GTM)

This library can also be integrated with Google Tag Manager using `dataLayer.push()` events.
17 changes: 17 additions & 0 deletions adblockDetectorWithGA4.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
window.adblockDetector.init({
found: function () {
if (typeof gtag === 'function') {
gtag('event', 'adblock_detected', {
adblock_status: 'detected'
});
}
},

notFound: function () {
if (typeof gtag === 'function') {
gtag('event', 'adblock_not_detected', {
adblock_status: 'not_detected'
});
}
}
});