11th Jan, 2008

Speeding up Google Analytics loading time

Have you ever noticed that the loading time of a webpage that references http://www.google-analytics.com/urchin.js slows down drastically?

The solution is very simple. Host the urchin.js file on your server and update your local file automatically once daily.

All you need to do is set up a timer in the Application_Start Event and set it’s Elapsed property to 3500000 (i.e, 58 mins). Then, in the Elapsed event handler just write the following code that updates your local urchin.js file daily at Noon.

How easier can that be?

if (DateTime.Now.ToUniversalTime().Hour == 12)
{
try
{
//download google analytics
System.Net.WebClient client = new System.Net.WebClient();
client.DownloadFile(”http://www.google-analytics.com/urchin.js”, WebConfigurationManager.AppSettings["path"].ToString());
}
catch
{
//do nothing
}

}

Have you ever been to Malta? All you need to know is a click away! Malta Travel Guide, Bargain Accommodation in Malta, Malta Hotels

Responses

Don’t forget there’s the new GA code now ;)

https://www.google.com/support/googleanalytics/bin/answer.py?answer=69588&hl=en_US

Yo, I find your blog truly informative and would only say WOw. Some information, I would like to find more precisely. If you are withholding information about this contribution did, it would really fond of you, tell me this.

Leave a response

Your response:

Categories