Last Thursday's Google outage had a dramatic impact on more than just Google users; it was widely reported that the outage killed 5% of Internet traffic and prevented users from accessing popular services such as Gmail and YouTube. The less-reported aspect of the story is that the outage also impacted some websites using Google Analytics. During the outage, the visitors to those sites noticed distinctly slower-than-normal loading times.
The slow-loading websites problem was caused by the way that the Google Analytics tracking code was added to the site pages. The Google Analytics page tags are hosted on Google's servers, so if the tracking code was placed at the top of the HTML page, visitors experienced delays while the content below that code loaded.
There are risks and benefits with placing web analytics page tags near the top of the HTML code or near the bottom. Last week's outage highlighted the risk of placing the tag at the top. Because of this potential issue, Stratigent has generally recommended that the Google tracking code be placed at the bottom of the page, immediately before the tag. This ensures that visitors see your site content before the Google page tag is requested.
Although there are some exceptions, this best practice also applies to other page tag-based tools. There are rare cases when the data-collection servers for any web analytics tool are either down or slow. Putting the page tag code near the bottom of the page will prevent this from adversely affecting the visitor experience.