Skip to content

Phase 3, Task 12: Make GoogleTagManagerIntegration rewrite fragment-safe #587

@aram356

Description

@aram356

Parent: #563

Summary

`GoogleTagManagerIntegration::rewrite()` checks `content.contains("googletagmanager.com")` on individual text fragments. If lol_html splits `"google" | "tagmanager.com/gtm.js"` across chunks, the match fails silently.

Changes

  • Accumulate text fragments until `last_in_text_node()` is true
  • Match and rewrite on the complete accumulated text
  • Add regression test with small chunk size that splits an inline GTM script mid-domain

File: `crates/trusted-server-core/src/integrations/google_tag_manager.rs`

Plan

See `docs/superpowers/specs/2026-03-25-streaming-response-design.md` — Phase 3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions