Hi katfromtheventury, thanks and sorry for the late reply.
Basically, when u put the script of the GTM into the index.html, it will load immediately and, to push events you'll have to create a custom hook or use always the window.dataLayer.push (or the custom name you've defined).
With this hook, you can load the GTM when u want, maybe not at the bootstrap of the app, maybe layer or maybe by a custom trigger.
You can also configure the tag manager in the same place without doing it editing the script generated by Google.
Hope this help!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Guido, thanks for the helpful post! Can you please explain what the downside/difference is of just puting the code into the index.html?
Hi katfromtheventury, thanks and sorry for the late reply.
Basically, when u put the script of the GTM into the index.html, it will load immediately and, to push events you'll have to create a custom hook or use always the
window.dataLayer.push(or the custom name you've defined).With this hook, you can load the GTM when u want, maybe not at the bootstrap of the app, maybe layer or maybe by a custom trigger.
You can also configure the tag manager in the same place without doing it editing the script generated by Google.
Hope this help!