Friday, April 4, 2008

Page Hit Counter in SharePoint

You would have seen many sites displaying page hit counters. To display this in SharePoint page, insert the “Hit Counter” web component from SharePoint Designer.

Open your site or your sites Master page to insert this component. For the demonstration purpose, I’ve use my default.aspx to insert the “Hit Counter” component. Once the page is opened in SharePoint Designer, place the cursor where you want to insert the hit counter. Go to Insert --> Web Component.




Click on the Web Component, this will display the available web components. You can find different types of other components readily available.



Click on the Hit Counter component, this will display different counter styles. Select any one style from the list. I have selected the below marked style.



Click on “Finish”, this will open the below Hit Counter Properties window.



You can even create your own Hit Counter. Use “Reset counter to” to reset the counter from a given number. To display fixed number of digits use “Fixed number of digits” property. Click on “Ok”, the hit counter will be inserted to your page. The below code will be inserted in your page to display the counter.



Now, preview your page from SharePoint Designer / a Web browser. You can see the Hit Counter incremented for each hit.



You can see the Hit Counter increments for each hit.