Monday, June 4, 2012

Adding a Hit counter Webpart in Sharepoint 2010

As I was working On hit counter for Sharepoint 2007 I also wanted to check if there is anything available for Sharepoiunt 2010 .

And Yes There is a Webpart available on Codeplex which works without any issues .

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.Username -            Single line of text

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.Click Ok

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

Download the Web part from the Below Link
http://hitcounter.codeplex.com/releases/view/35682

After You download the Solution Add the Solution to the Farm using the stsadm command

stsadm -o addsolution -filename HitCounter.wsp

to better understand

stsadm -o addsolution
   -filename <solution file name>
   [-lcid] <language>

Then go to the SharePoint Central Admin => Operations > Solution Management to deploy the solution.
After that go to the Site Collection Features where the solution is deployed and activate the feature HitCounter. Now, the Hit Counter web Part will be available for the users.

You can also deploy the solution using the Command prompt

 stsadm -o deploysolution -filename HitCounter.wsp

Syntax

stsadm -o deploysolution
   -name <solution name>
   [-url] <virtual server URL>
   [-allcontenturls]
   [-time] <time to deploy>
   [-immediate]
   [-local]
   [-allowgacdeployment]
   [-allowcaspolicies]
   [-lcid] <language>
   [-force]

 

4 comments:

  1. Hi,Hit Counter is page counter but I do not want page counter, I need SharePoint Website Visitors Counter and to take this info and put it at the home page. But can Hit Counter do that?but how if can..
    Thanks

    ReplyDelete
    Replies
    1. HI ,

      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.

      Check the below link for more information

      http://hitcounter.codeplex.com/

      Delete
  2. I want hitcounter for list item

    ReplyDelete
  3. It's in reality a great and useful piece of info. I am glad that you shared this helpful information with us. Please stay us up to date like this.
    website design

    ReplyDelete

Users cannot see the checked out files in the folder/ library

I Came across a Issue today wherein the user opened a ticket for the below issue Issue : Users cannot see the checked out files in the fo...