Skip to content

Conversation

@prk-Jr
Copy link
Collaborator

@prk-Jr prk-Jr commented Feb 9, 2026

Scripts like GTM and GA4 are often blocked by ad blockers or privacy extensions when loaded from third-party domains, leading to data loss. Third-party cookie deprecation further limits tracking durability.

This change transparently proxies GTM scripts and analytics beacons through the Trusted Server, establishing a first-party context. It automatically rewrites HTML tags and script content to point to local proxy endpoints, bypassing blockers and extending cookie life.

Includes:

  • Proxy endpoints for gtm.js and /collect with optimal caching (1h TTL) and strict validation
  • Content rewriting to redirect internal GTM calls to the local proxy
  • Configuration validation to ensure safe upstream handling
  • Comprehensive testing, including unit and integration tests covering configuration, rewriting logic, and header validation

Resolves: #224

Scripts like GTM and GA4 are often blocked by ad blockers and privacy extensions when loaded from third-party domains, leading to data loss. Third-party cookie deprecation further limits tracking durability.

This change proxies GTM scripts and analytics beacons through the Trusted Server, establishing a first-party context. It automatically rewrites HTML tags and script content to point to local proxy endpoints, bypassing blockers and extending cookie life.

Includes:

Proxy endpoints for gtm.js and /collect
Content rewriting for redirecting internal GTM calls
Configuration and integration tests

Resolves: #224
@prk-Jr prk-Jr self-assigned this Feb 9, 2026
@prk-Jr prk-Jr marked this pull request as draft February 9, 2026 09:20
@prk-Jr prk-Jr marked this pull request as ready for review February 9, 2026 10:23
@prk-Jr prk-Jr marked this pull request as draft February 9, 2026 10:24
Adds comprehensive tests for:
- GTM configuration parsing and default values
- HTML processor pipeline integration
- Response body rewriting logic
@prk-Jr prk-Jr marked this pull request as ready for review February 9, 2026 11:13
Copy link
Collaborator

@aram356 aram356 left a comment

Choose a reason for hiding this comment

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

🔧 Please make sure checks pass before assigning to review.

@prk-Jr prk-Jr requested a review from aram356 February 10, 2026 12:20
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.

As publisher I want to host GTM in publisher domain

2 participants