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.


Rodolfo Finochietti View All →

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

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: