@georgestephanis I’m not sure what the recommended GTM implementation was when you created the plugin, but the current instructions from Google are to implement the part of the script with the immediately invoked function expression as high in the document head as possible (so an early wp_head
hook) and the part with the noscript tag just after the opening body tag. What I’m suggesting is that you just leave the noscript tag in the footer and bump the other portion to the head to see if that fixes implementations such as when trying to dynamically inject the Google Analytics tag.
It may not resolve all the issues, but would definitely get you closer to a correct implementation.
However, I do like the idea of checking for a theme hook alliance implementation and changing up the hooks for the noscript portion so that it can actually load right after the opening body tag.
We should probably open a ticket for adding a hook in WordPress after the opening body tag (I haven’t checked to see if one already exists).
-
This reply was modified 7 years, 10 months ago by Micah Wood.