So, a customer of ours is upgrading to SharePoint 2007. One of the things they were looking for is a hit counter, so they can see the number of times a page was requested. This was easy for them to do in SharePoint 2003 – they’d just use FrontPage, and insert a Hit Counter web component. I’d never heard of such a thing build into 2007, but over morning coffee, I decided to give it a try. Much to my surprise, it works… …sort of.
There is a hit counter (albeit with an awful set of styles). It does work too:
That’s one of the better styles, believe it or not. So, what’s the problem with this?
Well, in normal pages, nothing. It counts; ’nuff said. However, publishing pages are a bit different. They store metadata in a ‘Page Content Type‘ and then use Page Layouts to render that data. What this means is that many things that appear to the user as separate pages actually use just one ASPX file for rendering their content – and this is where the hit counter doesn’t work. It counts the number of hits on the ASPX page – so instead of getting a number of hits on that page of content, you get the number of hits on content using that page layout. Which sucks a bit.
I’ll look into this a bit more soon, and see what I find. It can’t be that hard – apart from the whole ‘Page Layout’ thing, it’s not exactly rocket science.
8 thoughts on “Page hit counter in MOSS”
You can add hit counter to any page using sharepoint designer 2007
Jus open the site and then click on insert web component and then Hit counter thats it
Well, yes, except that it doesn’t work properly on Publishing Pages. See the article above!
Correct. Doesn’t work on page layouts or master pages…unless you want to count the number of hits on your master page or page layout instead of the individual page!
can i use the same page for two different sites to get the hitcounter
I doesnt have access to Sharepoint Designer, only the editor in the web browser.
How can I add the counter?
I cannot find it anywhere..
I don’t think there is a way then. You may be able to use third party system – like google analytics – but only in certain circumstances.
I want to add counter for my annoucement ,Is this way work or not?
It does work, provided you are not using Publishing Pages in SharePoint. Though to be honest, there are better ways to get usage statistics, particularly in recent versions of SharePoint.