admin管理员组文章数量:1398781
We use GTM for our GA4 config tag and events. However, the CRM site doesn't integrate with GA4. While we have our GTM container installed on it, it hasn't been super reliable to look for the visibility of a thank you message after submitting an important form. The DBA configures the thank you messages and I recently learned that we can include javascript and html in those thank you messages, which would be more reliable.
How would I get a GA4 event to fire when the message is displayed on the page (whether or not the user scrolls to see it))? Do I just embed the gtag('event','eventname'); code in tags within the message ? Does it need any other code to trigger it? Could there be timing issues if the GA4 config tag isn't fired first from the GTM container (it's set to trigger on Initialization)?
I'm not a webdev or programmer, so looking for basic info.
To test it out, I edited a test page on our wordpress site and added:
<script> gtag('event', 'test_inline_ga_event'); </script>
into a random content . But in the console it says "Uncaught ReferenceError: gtag is not defined." Timing issue with the GA4 config tag?
Because I see other GTAG commands (from gtm) firing just fine afterwards. How can I be sure to only fire the command after the GA4 config tag has run?
Thanks! Jannette
本文标签: javascriptHow to embed gtag GA4 event in a div when loadedStack Overflow
版权声明:本文标题:javascript - How to embed gtag GA4 event in a div when loaded? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744633816a2616700.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论