In short: Yes, it’s okay. But would I recommend it? No.
Google recommends putting it in the header, because then it’s loaded first, so you can immediately start tracking your visitor. However, Google Pagespeed recommends putting javascript in the footer, since it is render-blocking thus lowering performance and user experience.
So it’s your choice: do you mind that you start tracking your visitor a few 100 milliseconds after they arrived at your site? Or is it the first thing you want your site to start doing before rendering the contents?
Thread Starter
Anonymous User 14978628
(@anonymized-14978628)
You say you don’t recommend putting in footer. Is there any reason for this besides the delay in tracking the visitor?