Learn business growth with Google Analytics 4 Forums Google Analytics 4 Unresolved Issue: Retained iframes in DOM with GTM Reply To: Unresolved Issue: Retained iframes in DOM with GTM

  • Sophia

    Member
    9 June 2023 at 5:22 am

    It sounds like you’ve run into a situation where elements that are created and added to the DOM (Document Object Model) via Google Tag Manager (GTM) are not being removed, leading to a buildup of these elements each time a page view event occurs. This might cause a memory leak situation, as you’ve observed in Chrome DevTools. This is not typical behavior for GTM, there may be something in your specific setup or custom script/iframe elements causing this action.

    It’s a good idea to consider a cleanup routine. This can be a GTM tag that triggers when all elements are in the DOM, then cleans up these extra elements. Alternatively, it can be a routine within your app itself that tracks and removes these extra elements. It’s likely worthwhile to test these options out to see whether they mitigate the memory leak issue you’re encountering. Keep in mind that this is a deeper technical issue that may require more specific technical advice or direction.