tags:

views:

373

answers:

3

What is the simplest way to count # of visits by a user in an ASP.NET web app?

Our app services anonymous users, registered users and an intermediate user, called a "prospect". Prospects are users that request information but do not create an account.

We leave an ID cookie for every type of user, and that's the key into our database for visit information.

Prospects never "sign in" per se, but we still want to count those visits. We also want to count member visits, even when they don't sign in.

I am thinking of storing the ASP.NET Session cookie and then incrementing our counter every time the session cookie changes.

Anyone out there already solve this, or have any suggestions?

PS: We are ASP.NET 1.1

Refinement: We want this data in our app's database, so Google Analytics is not a reasonable solutions for this...and we are using Google Analytics.

+1  A: 

Since you're using 1.1... in the Global.aspx... in the App_EndRequest (or whatever), insert a record into a DB with Name, IPAddress, timestamp, etc.

EDIT: Don't do the session thingy, sessions can be cleared, plus how will you report on them days, or weeks later... insert a record (including the Request.Url.Path if you'd like to have those kinds of stats).

Because it's on the EndRequest method, it's pretty safe even if there is some sort of glitch... also, performance won't matter as the user has gotten his page sent to him already.

Timothy Khouri
This seems like the right approach, I'm going to have to look at the events in Global.asax...I don't think EndRequest is the right event, it should be SessionBegin or something like that...I this beats the heck out of monitoring the ASPX Session Cookie - THANK YOU!
arrocharGeek
A: 

We leave an ID cookie for every type of user, and that's the key into our database for visit information

Sounds to me like you already have a counter, you just need to figure out a way to make this data useful.

SELECT COUNT(1) FROM TblUsers WHERE UserType = 'Prospect' AND DateRange Between....
FlySwat
+2  A: 

Use Google Analytics. You can specify "goals" and "funnels" that lead to these goals quite easily.

Diodeus
We use Google Analytics already, however I need this data in our back end, so Google Analytics is not our solution for this.
arrocharGeek