Google Analytics Module

Some months ago Daniel Cazzulino publishes an excellent IHttpModule to use Google Analitycs with adding code in the pages of a web site.
After using it some weeks I found an error that affects the Clearscreen CAPTCHA Antispam Control.
Basically the problem is that the module adds the HTML code necessary to use Google Analytics in responses that are not HTML (like an image).

This is quick fix to this bug:

void OnBeginRequest(object sender, EventArgs e)
{
   if ( String.Compare(“text/html”, application.Response.ContentType, true) == 0
&& ! ( application.Request.QueryString.Count != 0
&& application.Request.QueryString.GetKey(0) == “hip” ) )
application.Response.Filter = new AnalyticsStream(application.Response.Filter, accountNumber);
}

Here you can download a test solution to reproduce this bug.

About Rodolfo Finochietti

Uma's and Gino's father, and a programmer ;)

Posted on 11/07/2006, in Tools. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: