-
What is the process to incorporate the GA4 tag into a separate .js file?
Hey there, I’m having a bit of a doozy. You see, I’ve got this script in the element on my webpage to do the job of tracking analytics with GA4 code, and that’s smooth sailing. But where I’m hitting a wall is trying to figure out how to give the new gtag.js script a spin in an external file. Any bright ideas?
For a wee bit of background, here’s the script I use in the element.
<!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=TRACKINGID"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'TRACKINGID'); </script>
Log in to reply.