Hit Counter Webpart
This webpart is very simple, contains few lines of code, before adding the webpart to the page first create a Custom List name it as
Statistics also create three columns in
Statistics list as below:
- url Multiple lines of text
- date Single line of text
- uname Single line of text
Also, you have to give the
Contribute – Can view, add, update, and delete permissions for the
Visitor and
Viewers for the
Statistics list, so that visitor/viewers visits also recorded in the list.
To give permissions
- Go to Statistics list, Settings > List Settings
- Under Permissions and Management click on Permissions for this list
- Select Visitors checkbox then click on Actions > Edit User Permissions then select Contribute – Can view, add, update, and delete
- Finally click Ok button
Please Note: For applying
Contribute – Can view, add, update, and delete permissions for
Viewers repeat the above
1,
2,
3 and
4 steps
If a user is new to current page on the day, the code adds a record to
Statistics list, if the same user visits the same page the code just returns out from condition and do nothing, because the user already visited the page on the same day, this is all because of to maintain the unique hits
To know the hit count for all pages in site, you have to place the webpart in master page, so that the webpart code runs on every page where the visitor go and makes the unique entry in
Statistics list
Statistics List
Follow the instructions on how to deploy the solution on page
http://hitcounter.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=35682AuthorG Vijai Kumar
http://www.fivenumber.com