Page view count

Page view count

  A very common question How to count page visits to my site?
Well, it can be done in many ways. Here, I will shade some lights on simple and better approch.

Using ASp.net server side code.
 When browser begins the request, OnBeginRequest event you can count the page views againt that requet.
What if the request is coming from Load Testing tool or any robot? It is simple approch but not good.
It doesn't ensure that the request is coming from browser.

Many people think to use OnbeginRequest event. This way you will count unnecessory stuff like request to css file or javascript file or image content


Better approch:
Create a javascript which will execute at client side browser. Once it start requesting the server apply your logi to count the page visit.
This ensures that the request is coming from Browser as script engine inside the browser is making call.

You can see Google analytics and other tools who can be used to tracks the traffice on your site uses JavaScript.
If you planned to create your own, the benifit is you can have this module of tracking something out of box.

Satalaj

Tags:

Gridview select emailAsp.net Interview Questions for 2 years or 3 years experianceAndroid WebView Examplegridview add new rowDo you want to view only the webpage content that was delivered securelyasp.net Gridview checkboxGridView RowJquery Gridview Dropdownlist Selected Change Enable Disable ControlsAsp.net store value in ViewStateGridView EditLinq Group By Multiple Columns

Author

My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in ASP.net year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.
 

I'm Satalaj.