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

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.

1 participant