Daniel Cazzulino's Blog : How to turn on Google Analytics for your site in 2 lines of configuration: a custom IHttpModule

How to turn on Google Analytics for your site in 2 lines of configuration: a custom IHttpModule

Ok, so I got excited with Google Analytics , thanks to Scott Hanselman. So I decided to give it a quick try.

Turns out, you cannot give it a quick try unless you start changing your site's pages to include a piece of script before the </body>... yuck!

I searched the web and found no one who had done the simplest possible thing to have transparent support for Google Analytics on your site without touching a single page: a custom IHttpModule that uses the HttpResponse.Filter property to detect </body> and add the script automatically before sending the buffered output.

If your site is not a high-traffic, performance-sensitive one (i.e. your corporate site/blog/small community site), you may find this little guy useful (note that I only had about 20' to get it working ;-)). Download the module for .NET v.2.0 or the one for .NET 1.1. Configuration is mininal:

< configuration >

    < appSettings >

        < add key ="GoogleAnalyticsAccount"value="[Google Analytics Account #]"/>

    </ appSettings >

    < connectionStrings />

    < system.web >

        < compilation debug ="true"/>

        < authentication mode ="Windows"/>

        < httpModules >

            < add name ="GoogleAnalytics"type="Clarius.GoogleAnalyticsModule"/>

        </ httpModules >

    </ system.web >

</ configuration >

 Enjoy!

posted on Thursday, June 08, 2006 8:10 AM by kzu

# re: How to turn on Google Analytics for your site in 2 lines of configuration: a custom IHttpModule @ Friday, June 09, 2006 8:22 AM

Nice !!!

OmegaSupreme

# re: How to turn on Google Analytics for your site in 2 lines of configuration: a custom IHttpModule @ Saturday, August 19, 2006 10:01 PM

<a href="http://nanaly.com/bbs/data/logs/1.htm ">bbs</a> <a href="http://nanaly.com/bbs/data/logs/2.htm ">bbs</a> <a href="http://nanaly.com/bbs/data/logs/3.htm ">bbs</a> <a href="http://nanaly.com/bbs/data/logs/4.htm ">bbs</a> <a href="http://nanaly.com/bbs/data/logs/5.htm ">bbs</a> <a href="http://nanaly.com/bbs/data/logs/6.htm ">bbs</a> <a href="http://nanaly.com/bbs/data/logs/7.htm ">bbs</a> <a href="http://nanaly.com/bbs/data/logs/8.htm ">bbs</a> <a href="http://nanaly.com/bbs/data/logs/9.htm ">bbs</a> <a href="http://nanaly.com/bbs/data/logs/10.htm">bbs</a>

helli

# re: How to turn on Google Analytics for your site in 2 lines of configuration: a custom IHttpModule @ Sunday, August 27, 2006 3:24 PM

bad boy song
pizza boy sex
boys in swim trunks
father son and the holy ghost symbol
naked boy teen

father son beach