page check form starts here

Check Google Analytics


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:

  1. An Analytics Java Script loads before the main content of a web page, which causes a delay.
  2. 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

Google Analytics affects web site performance because it takes time to download. The Analytics JavaScript file size is around 5KB. Its download time will vary depending on a website visitor's location. Google server response time varies as well. Google has farms of servers across the globe. When a visitor loads your web page and sends a request for analytics Java Script, Google DNS server checks the IP address of the visitor and returns the IP address of the geographically closest Google server.

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.

As you can see, the Google load balanced server farms always provide the best performance. However this approach has a drawback. Sometimes, one of the thousands of Google servers may not be up. This is a rare event, but it happens. In this case, a part of a website audience might not load an Analytics JavaScript. If it is in the <head> tag, a web page may be not accessible. This problem is quite difficult to recognize, because only certain visitors will be affected.

To keep everything under your control you can place the Analytics JavaScript on your own server. In this case, only analytics web beacon will be loaded from a Google server. Its URL starts from The response time of analytics JavaScript will be the same as one of your web server. And the script download time will grow with increasing distance between a visitor and the web server.

Web Site Performance Measurement

We measured response and download times of web page elements using Truwex Online tool. You can access the results by clicking on the link "View the other test results of this web page" after checking Google Analytics. The Profile tab contains a full web page breakdown including JavaScript files and images loaded from dynamic code. Because Truwex uses a real instance of Internet Explorer to check your web site, your web content loads completely, including JavaScript and flash executions during run time. This reveals actual web page and web server performance similar to that of a real site visitor.

Erigami and Truwex details start here

Truwex can check Google Analytics code on every page of your website

If you like this tool and want to support it, place a hyperlink on your website:

Bookmark this page