You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🐛 Fixed - Tag Manager Plain Text Output & GTM Detection Failure
document.importNode(template.content, true) replaces template.innerHTML + div.innerHTML round-trip in output_delay_script(). Reading .innerHTML from a <template> element serializes its inert DocumentFragment back to an HTML string. Re-assigning that string to a div.innerHTML re-parses it in the live (scripting-enabled) document, where <noscript> is treated as a raw-text element — its child <iframe> becomes a literal text node that renders as visible markup on the page. document.importNode(template.content, true) clones nodes directly from the inert fragment with no serialization, preserving <noscript> structure correctly. Applied to all three tag blocks (head, body, footer).
.textContent replaces .innerHTML for inline script content copies. When recreating <script> elements in the delay injector, content was read/written via .innerHTML. The HTML serializer encodes characters such as & (present in GTM's '&l='+l snippet) to &, corrupting the script and causing Google Tag Assistant to fail to detect the tag. Switching to .textContent bypasses HTML serialization entirely.
Files Modified
includes/public/class-tag-manager.php — output_delay_script() head, body, and footer tag injection blocks