Reputation: 2403
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.
Upvotes: 3
Views: 1477
Reputation: 114347
Use Google Analytics. You can specify "goals" and "funnels" that lead to these goals quite easily.
Upvotes: 2
Reputation: 175583
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....
Upvotes: 0
Reputation: 31845
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.
Upvotes: 1