Search code examples
c#asp.net.net-3.5visitor-statistic

Determine how many users viewed a page


I am working on a component in C# to record how many unique viewers have viewed my website / page, making certain the same user revisiting, is not recorded twice. What is an efficient method to write such a component? Do you track cookies or session objects? Would I record their ip address (which is not static) or computer name? This information would be stored in a database (as far as I know)

Thanks.


Solution

  • Why reinvent the wheel? Use Google Analytics - it's free, extremely easy to implement, provides more statistics than you could ever want, and can provide (as best as it is possible using cookies) unique visitor stats. If you really need to store the data in a database (why?) then you can use the Google Analytics API to get at it and do what you want with it.