This project is read-only.
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:
  1. url Multiple lines of text
  2. date Single line of text
  3. 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
  1. Go to Statistics list, Settings > List Settings
  2. Under Permissions and Management click on Permissions for this list
  3. Select Visitors checkbox then click on Actions > Edit User Permissions then select Contribute – Can view, add, update, and delete
  4. 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

G Vijai Kumar | Follow on @gvijaikumar | Follow on 5Number

Last edited Mar 30, 2014 at 9:24 AM by gvijaikumar9, version 18