Google Analytics code placement on a web page
The best place for Google Analytics Java Script code is at the end of a web page, right before the </body> tag. This recommendation comes directly from on the Google Analytics help page.
However, early Google Analytics guidelines recommended placing code in the <head> tag, and there are still many web sites which follow this recommendation. This is not a good location for two reasons:
- An Analytics Java Script loads before the main content of a web page, which causes a delay.
- If Analytics Java Script cannot be loaded or executed, your web content may not be displayed at all.
Therefore, check your web pages and if you have Google Analytics code in the <head> tag, move it immediately before the </body> tag.
Google Analytics and Web Site Performance
For example, the Truwex server is based in Moscow, Russia. The average response time is 60ms and the average load time is 120ms regardless of web page location. Truwex always loads Google metrics script from the European server farm. If we were to move Truwex to the United States, the response time would be less.
Web Site Performance Measurement