Skip to content

Add GA4 integration example and GTM guidance - #9

Open
pankajrb wants to merge 1 commit into
InteractiveAdvertisingBureau:masterfrom
pankajrb:feature/ga4-gtm-support
Open

Add GA4 integration example and GTM guidance#9
pankajrb wants to merge 1 commit into
InteractiveAdvertisingBureau:masterfrom
pankajrb:feature/ga4-gtm-support

Conversation

@pankajrb

Copy link
Copy Markdown

Summary

This PR adds modern analytics implementation examples for:

  • Google Analytics 4 (GA4)
  • Google Tag Manager (GTM)

while preserving the existing ad block detection logic and keeping the implementation lightweight.

Motivation

The current repository includes an example implementation using Universal Analytics (ga()), which has been sunset by Google.

Modern publisher analytics implementations commonly use:

  • GA4
  • GTM
  • dataLayer.push() event patterns

This update provides simple reference examples for publishers who want to integrate the detection library with modern analytics stacks.

Changes Included

Added

  • adblockDetectorWithGA4.js

    • Example implementation using gtag('event', ...)

Updated

  • README.md

    • Added GA4 integration example
    • Added GTM integration guidance

Notes

  • No changes were made to the core detection logic
  • The implementation intentionally remains lightweight and framework-agnostic
  • Existing Universal Analytics examples remain untouched for backward compatibility

Comment thread README.md
- 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants