Mobile app version of vmapp.org
Login or Join
Gloria169

: Best tag placement for Analytics.js tracking code? I am using a webapp for my website which has an option in the settings to add my UA tracking code from google analytics. However, when I

@Gloria169

Posted in: #GoogleAnalytics #GoogleSearchConsole #Tracking

I am using a webapp for my website which has an option in the settings to add my UA tracking code from google analytics. However, when I view my source, it places the tracking code in the <body> tag. Google states it should be placed in the <head> although it still works as intended. I'm not sure if I should edit the source myself and place it in the <head> or just leave it as-is.

Are there downsides to having it in the <body> versus the <head>. Or does it not really matter?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Gloria169

1 Comments

Sorted by latest first Latest Oldest Best

 

@Harper822

Why Google wants you to place it in head, is to ensure high availability of tracking in order to track bounce rates better.

To elaborate on that: when the tracking script tag is placed into body tag, and user leaves the site before it is fully loaded, Analytics would not be able to track the visit and the visit will not affect your bounce rate.

So the upside of placing into head, is the better tracking of users who leave the site for performance reasons.

The downside of placing into head, however, is slower loading of the page itself.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme